From 377bc08d50d37931c4935c1b74ad8d514aa338e1 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Mon, 27 Nov 2023 10:32:58 +0100 Subject: [PATCH 001/110] Fix table imports --- .../connections/ConnectionsTable.tsx | 17 ++++++++++++++--- .../connections/CredentialsTable.tsx | 5 +++-- .../credentials/CredentialsTable.tsx | 5 +++-- ui/src/components/credentials/LinksTable.tsx | 5 +++-- ui/src/components/issuer-state/IssuerState.tsx | 5 +++-- ui/src/components/schemas/SchemasTable.tsx | 18 +++++++++++++++--- 6 files changed, 41 insertions(+), 14 deletions(-) diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index d43bd7b97..92fb6d0a9 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -1,5 +1,16 @@ -import { Avatar, Card, Divider, Dropdown, Row, Space, Table, Tag, Tooltip, Typography } from "antd"; -import { ColumnsType } from "antd/es/table"; +import { + Avatar, + Card, + Divider, + Dropdown, + Row, + Space, + Table, + TableColumnsType, + Tag, + Tooltip, + Typography, +} from "antd"; import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate, useSearchParams } from "react-router-dom"; @@ -44,7 +55,7 @@ export function ConnectionsTable() { const queryParam = searchParams.get(QUERY_SEARCH_PARAM); - const tableColumns: ColumnsType = [ + const tableColumns: TableColumnsType = [ { dataIndex: "userID", ellipsis: { showTitle: false }, diff --git a/ui/src/components/connections/CredentialsTable.tsx b/ui/src/components/connections/CredentialsTable.tsx index 0853ae6b5..4f9ae63dc 100644 --- a/ui/src/components/connections/CredentialsTable.tsx +++ b/ui/src/components/connections/CredentialsTable.tsx @@ -6,11 +6,12 @@ import { RadioChangeEvent, Row, Space, + Table, + TableColumnsType, Tag, Tooltip, Typography, } from "antd"; -import Table, { ColumnsType } from "antd/es/table"; import dayjs from "dayjs"; import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate } from "react-router-dom"; @@ -68,7 +69,7 @@ export function CredentialsTable({ userID }: { userID: string }) { search: `${DID_SEARCH_PARAM}=${userID}`, }); - const tableColumns: ColumnsType = [ + const tableColumns: TableColumnsType = [ { dataIndex: "schemaType", ellipsis: { showTitle: false }, diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index 43866048d..f1d4d0426 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -7,11 +7,12 @@ import { RadioChangeEvent, Row, Space, + Table, + TableColumnsType, Tag, Tooltip, Typography, } from "antd"; -import Table, { ColumnsType } from "antd/es/table"; import dayjs from "dayjs"; import { useCallback, useEffect, useState } from "react"; import { Link, generatePath, useNavigate, useSearchParams } from "react-router-dom"; @@ -71,7 +72,7 @@ export function CredentialsTable() { const showDefaultContent = credentials.status === "successful" && credentialsList.length === 0 && queryParam === null; - const tableColumns: ColumnsType = [ + const tableColumns: TableColumnsType = [ { dataIndex: "schemaType", ellipsis: { showTitle: false }, diff --git a/ui/src/components/credentials/LinksTable.tsx b/ui/src/components/credentials/LinksTable.tsx index fb2e1ba72..1561180bb 100644 --- a/ui/src/components/credentials/LinksTable.tsx +++ b/ui/src/components/credentials/LinksTable.tsx @@ -10,12 +10,13 @@ import { Space, Switch, Table, + TableColumnsType, Tag, Tooltip, Typography, message, } from "antd"; -import { ColumnsType } from "antd/es/table"; + import dayjs from "dayjs"; import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate, useSearchParams } from "react-router-dom"; @@ -70,7 +71,7 @@ export function LinksTable() { const status = parsedStatusParam.success ? parsedStatusParam.data : undefined; - const tableColumns: ColumnsType = [ + const tableColumns: TableColumnsType = [ { dataIndex: "active", ellipsis: true, diff --git a/ui/src/components/issuer-state/IssuerState.tsx b/ui/src/components/issuer-state/IssuerState.tsx index 174d3e7fa..b762117c9 100644 --- a/ui/src/components/issuer-state/IssuerState.tsx +++ b/ui/src/components/issuer-state/IssuerState.tsx @@ -6,12 +6,13 @@ import { Row, Space, Table, + TableColumnsType, Tag, Tooltip, Typography, message, } from "antd"; -import { ColumnsType } from "antd/es/table"; + import dayjs from "dayjs"; import { useCallback, useEffect, useMemo, useState } from "react"; import { Link } from "react-router-dom"; @@ -87,7 +88,7 @@ export function IssuerState() { [env] ); - const tableColumns: ColumnsType = [ + const tableColumns: TableColumnsType = [ { dataIndex: "txID", ellipsis: { showTitle: false }, diff --git a/ui/src/components/schemas/SchemasTable.tsx b/ui/src/components/schemas/SchemasTable.tsx index 1a0c14034..b27ad58e9 100644 --- a/ui/src/components/schemas/SchemasTable.tsx +++ b/ui/src/components/schemas/SchemasTable.tsx @@ -1,5 +1,17 @@ -import { Avatar, Button, Card, Grid, Row, Space, Table, Tag, Tooltip, Typography } from "antd"; -import { ColumnsType } from "antd/es/table"; +import { + Avatar, + Button, + Card, + Grid, + Row, + Space, + Table, + TableColumnsType, + Tag, + Tooltip, + Typography, +} from "antd"; + import { useCallback, useEffect, useState } from "react"; import { Link, generatePath, useSearchParams } from "react-router-dom"; @@ -36,7 +48,7 @@ export function SchemasTable() { const queryParam = searchParams.get(QUERY_SEARCH_PARAM); - const tableColumns: ColumnsType = [ + const tableColumns: TableColumnsType = [ { dataIndex: "type", ellipsis: { showTitle: false }, From afd374d434067f089c320668e7d68f606660c8fe Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Tue, 28 Nov 2023 19:26:34 +0100 Subject: [PATCH 002/110] Fix mobile header background color --- ui/src/styles/theme.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/styles/theme.ts b/ui/src/styles/theme.ts index db39992a0..db5d7e59d 100644 --- a/ui/src/styles/theme.ts +++ b/ui/src/styles/theme.ts @@ -68,7 +68,7 @@ export const theme: ThemeConfig = { Form: { fontSize: 14 }, Input: { controlHeight: 40 }, InputNumber: { controlHeight: 40 }, - Layout: { bodyBg: "white", siderBg: "white" }, + Layout: { bodyBg: "white", headerBg: "white", siderBg: "white" }, Menu: { itemHoverBg: "white", itemHoverColor: primaryColor, From 7f2366169651db81efc41986beb1eae9af77ffab Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Tue, 28 Nov 2023 19:28:39 +0100 Subject: [PATCH 003/110] Implement pagination on the credentials page --- ui/src/adapters/api/credentials.ts | 28 +++++-- ui/src/adapters/parsers/index.ts | 35 ++++++++- .../connections/CredentialsTable.tsx | 4 +- .../credentials/CredentialsTable.tsx | 78 ++++++++++++++++++- ui/src/utils/constants.ts | 2 + ui/src/utils/types.ts | 11 +++ 6 files changed, 143 insertions(+), 15 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 0ca962f49..786565b95 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -3,10 +3,15 @@ import { z } from "zod"; import { Response, buildErrorResponse, buildSuccessResponse } from "src/adapters"; import { ID, IDParser, Message, buildAuthorizationHeader, messageParser } from "src/adapters/api"; -import { datetimeParser, getListParser, getStrictParser } from "src/adapters/parsers"; +import { + datetimeParser, + getListParser, + getResourceParser, + getStrictParser, +} from "src/adapters/parsers"; import { Credential, Env, IssuedQRCode, Json, Link, LinkStatus, ProofType } from "src/domain"; import { API_VERSION, QUERY_SEARCH_PARAM, STATUS_SEARCH_PARAM } from "src/utils/constants"; -import { List } from "src/utils/types"; +import { List, Resource } from "src/utils/types"; type ProofTypeInput = "BJJSignature2021" | "SparseMerkleTreeProof"; @@ -86,17 +91,19 @@ export async function getCredential({ export async function getCredentials({ env, - params: { did, query, status }, + params: { did, max_results, page, query, status }, signal, }: { env: Env; params: { did?: string; + max_results?: number; + page?: number; query?: string; status?: CredentialStatus; }; signal?: AbortSignal; -}): Promise>> { +}): Promise>> { try { const response = await axios({ baseURL: env.api.url, @@ -108,15 +115,20 @@ export async function getCredentials({ ...(did !== undefined ? { did } : {}), ...(query !== undefined ? { [QUERY_SEARCH_PARAM]: query } : {}), ...(status !== undefined && status !== "all" ? { [STATUS_SEARCH_PARAM]: status } : {}), + ...(max_results !== undefined ? { max_results: max_results.toString() } : {}), + ...(page !== undefined ? { page: page.toString() } : {}), }), signal, url: `${API_VERSION}/credentials`, }); return buildSuccessResponse( - getListParser(credentialParser) - .transform(({ failed, successful }) => ({ - failed, - successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), + getResourceParser(credentialParser) + .transform(({ items: { failed, successful }, meta }) => ({ + items: { + failed, + successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), + }, + meta, })) .parse(response.data) ); diff --git a/ui/src/adapters/parsers/index.ts b/ui/src/adapters/parsers/index.ts index 6f2f0392c..48a9046cd 100644 --- a/ui/src/adapters/parsers/index.ts +++ b/ui/src/adapters/parsers/index.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { List } from "src/utils/types"; +import { List, Meta } from "src/utils/types"; export function getListParser( parser: z.ZodSchema @@ -35,6 +35,25 @@ export function getListParser( ); } +const metaParser = getStrictParser()( + z.object({ + current: z.number(), + max_results: z.number(), + total: z.number(), + }) +); + +export function getResourceParser( + parser: z.ZodSchema +) { + return getStrictParser<{ items: unknown[]; meta: Meta }, { items: List; meta: Meta }>()( + z.object({ + items: getListParser(parser), + meta: metaParser, + }) + ); +} + export const datetimeParser = getStrictParser()( z .string() @@ -50,6 +69,20 @@ export const datetimeParser = getStrictParser()( }) ); +export const numberFromStringParser = getStrictParser()( + z.string().transform((value, context) => { + const trimmed = value.trim(); + const valueToParse = trimmed === "" ? undefined : Number(trimmed); + const parsedNumber = z.number().safeParse(valueToParse); + if (parsedNumber.success) { + return parsedNumber.data; + } else { + parsedNumber.error.issues.map(context.addIssue); + return z.NEVER; + } + }) +); + // The following was implemented due to a perceived limitation of Zod: // https://github.com/colinhacks/zod/issues/652 diff --git a/ui/src/components/connections/CredentialsTable.tsx b/ui/src/components/connections/CredentialsTable.tsx index 4f9ae63dc..6a1683707 100644 --- a/ui/src/components/connections/CredentialsTable.tsx +++ b/ui/src/components/connections/CredentialsTable.tsx @@ -193,10 +193,10 @@ export function CredentialsTable({ userID }: { userID: string }) { }); if (response.success) { setCredentials({ - data: response.data.successful, + data: response.data.items.successful, status: "successful", }); - notifyParseErrors(response.data.failed); + notifyParseErrors(response.data.items.failed); } else { if (!isAbortedError(response.error)) { setCredentials({ error: response.error, status: "failed" }); diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index f1d4d0426..17e58c5f5 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -18,6 +18,7 @@ import { useCallback, useEffect, useState } from "react"; import { Link, generatePath, useNavigate, useSearchParams } from "react-router-dom"; import { credentialStatusParser, getCredentials } from "src/adapters/api/credentials"; +import { numberFromStringParser } from "src/adapters/parsers"; import IconCreditCardPlus from "src/assets/icons/credit-card-plus.svg?react"; import IconCreditCardRefresh from "src/assets/icons/credit-card-refresh.svg?react"; import IconDots from "src/assets/icons/dots-vertical.svg?react"; @@ -42,6 +43,8 @@ import { ISSUED, ISSUE_CREDENTIAL, ISSUE_DATE, + PAGINATION_CURRENT_PARAM, + PAGINATION_MAX_RESULTS_PARAM, QUERY_SEARCH_PARAM, REVOCATION, REVOKE, @@ -68,6 +71,26 @@ export function CredentialsTable() { const parsedStatusParam = credentialStatusParser.safeParse(statusParam); const credentialStatus = parsedStatusParam.success ? parsedStatusParam.data : "all"; + const paginationCurrentParsed = numberFromStringParser.safeParse( + searchParams.get(PAGINATION_CURRENT_PARAM) + ); + const paginationPageSizeParsed = numberFromStringParser.safeParse( + searchParams.get(PAGINATION_MAX_RESULTS_PARAM) + ); + + const DEFAULT_PAGINATION_CURRENT = 1; + const DEFAULT_PAGINATION_PAGE_SIZE = 10; + const DEFAULT_PAGINATION_TOTAL = 0; + + const [paginationTotal, setPaginationTotal] = useState(DEFAULT_PAGINATION_TOTAL); + + const paginationCurrent = paginationCurrentParsed.success + ? paginationCurrentParsed.data + : DEFAULT_PAGINATION_CURRENT; + const paginationPageSize = paginationPageSizeParsed.success + ? paginationPageSizeParsed.data + : DEFAULT_PAGINATION_PAGE_SIZE; + const credentialsList = isAsyncTaskDataAvailable(credentials) ? credentials.data : []; const showDefaultContent = credentials.status === "successful" && credentialsList.length === 0 && queryParam === null; @@ -178,6 +201,28 @@ export function CredentialsTable() { }, ]; + const updatePaginationParams = useCallback( + (pagination: { current?: number; pageSize?: number }) => { + setSearchParams((previousParams) => { + const params = new URLSearchParams(previousParams); + params.set( + PAGINATION_CURRENT_PARAM, + pagination.current !== undefined + ? pagination.current.toString() + : DEFAULT_PAGINATION_CURRENT.toString() + ); + params.set( + PAGINATION_MAX_RESULTS_PARAM, + pagination.pageSize !== undefined + ? pagination.pageSize.toString() + : DEFAULT_PAGINATION_PAGE_SIZE.toString() + ); + return params; + }); + }, + [setSearchParams] + ); + const fetchCredentials = useCallback( async (signal?: AbortSignal) => { setCredentials((previousCredentials) => @@ -189,6 +234,8 @@ export function CredentialsTable() { const response = await getCredentials({ env, params: { + max_results: paginationPageSize, + page: paginationCurrent, query: queryParam || undefined, status: credentialStatus, }, @@ -196,17 +243,29 @@ export function CredentialsTable() { }); if (response.success) { setCredentials({ - data: response.data.successful, + data: response.data.items.successful, status: "successful", }); - notifyParseErrors(response.data.failed); + setPaginationTotal(response.data.meta.total); + updatePaginationParams({ + current: response.data.meta.current, + pageSize: response.data.meta.max_results, + }); + notifyParseErrors(response.data.items.failed); } else { if (!isAbortedError(response.error)) { setCredentials({ error: response.error, status: "failed" }); } } }, - [env, queryParam, credentialStatus] + [ + env, + paginationPageSize, + paginationCurrent, + queryParam, + credentialStatus, + updatePaginationParams, + ] ); const onSearch = useCallback( @@ -289,6 +348,7 @@ export function CredentialsTable() { ...column, }))} dataSource={credentialsList} + loading={credentials.status === "reloading"} locale={{ emptyText: credentials.status === "failed" ? ( @@ -297,7 +357,17 @@ export function CredentialsTable() { ), }} - pagination={false} + onChange={(pagination) => { + setPaginationTotal(pagination.total || DEFAULT_PAGINATION_TOTAL); + updatePaginationParams(pagination); + }} + pagination={{ + current: paginationCurrent, + hideOnSinglePage: true, + pageSize: paginationPageSize, + position: ["bottomRight"], + total: paginationTotal, + }} rowKey="id" showSorterTooltip sortDirections={["ascend", "descend"]} diff --git a/ui/src/utils/constants.ts b/ui/src/utils/constants.ts index 71e601ac8..15463d687 100644 --- a/ui/src/utils/constants.ts +++ b/ui/src/utils/constants.ts @@ -34,6 +34,8 @@ export const DID_SEARCH_PARAM = "did"; export const QUERY_SEARCH_PARAM = "query"; export const SCHEMA_SEARCH_PARAM = "schema"; export const STATUS_SEARCH_PARAM = "status"; +export const PAGINATION_CURRENT_PARAM = "current"; +export const PAGINATION_MAX_RESULTS_PARAM = "max_results"; export const API_VERSION = "v1"; diff --git a/ui/src/utils/types.ts b/ui/src/utils/types.ts index 35ff1c5dc..1dce18264 100644 --- a/ui/src/utils/types.ts +++ b/ui/src/utils/types.ts @@ -1,8 +1,19 @@ import { z } from "zod"; +export type Meta = { + current: number; + max_results: number; + total: number; +}; + export type List = { failed: z.ZodError[]; successful: T[]; }; +export type Resource = { + items: List; + meta: Meta; +}; + export type Nullable = T | null | undefined; From b14f888d35818459638d299bf07ce8eb681eb1e2 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Thu, 7 Dec 2023 11:28:10 +0100 Subject: [PATCH 004/110] Use pagination API terminology --- ui/src/adapters/parsers/index.ts | 2 +- .../credentials/CredentialsTable.tsx | 65 +++++++++---------- ui/src/utils/constants.ts | 6 +- ui/src/utils/types.ts | 2 +- 4 files changed, 39 insertions(+), 36 deletions(-) diff --git a/ui/src/adapters/parsers/index.ts b/ui/src/adapters/parsers/index.ts index 48a9046cd..26f8bb69b 100644 --- a/ui/src/adapters/parsers/index.ts +++ b/ui/src/adapters/parsers/index.ts @@ -37,8 +37,8 @@ export function getListParser( const metaParser = getStrictParser()( z.object({ - current: z.number(), max_results: z.number(), + page: z.number(), total: z.number(), }) ); diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index 17e58c5f5..c4a35ae5a 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -36,6 +36,9 @@ import { ROUTES } from "src/routes"; import { AsyncTask, isAsyncTaskDataAvailable, isAsyncTaskStarting } from "src/utils/async"; import { isAbortedError, makeRequestAbortable } from "src/utils/browser"; import { + DEFAULT_PAGINATION_MAX_RESULTS, + DEFAULT_PAGINATION_PAGE, + DEFAULT_PAGINATION_TOTAL, DELETE, DETAILS, DOTS_DROPDOWN_WIDTH, @@ -43,8 +46,8 @@ import { ISSUED, ISSUE_CREDENTIAL, ISSUE_DATE, - PAGINATION_CURRENT_PARAM, PAGINATION_MAX_RESULTS_PARAM, + PAGINATION_PAGE_PARAM, QUERY_SEARCH_PARAM, REVOCATION, REVOKE, @@ -71,25 +74,21 @@ export function CredentialsTable() { const parsedStatusParam = credentialStatusParser.safeParse(statusParam); const credentialStatus = parsedStatusParam.success ? parsedStatusParam.data : "all"; - const paginationCurrentParsed = numberFromStringParser.safeParse( - searchParams.get(PAGINATION_CURRENT_PARAM) + const paginationPageParsed = numberFromStringParser.safeParse( + searchParams.get(PAGINATION_PAGE_PARAM) ); - const paginationPageSizeParsed = numberFromStringParser.safeParse( + const paginationMaxResultsParsed = numberFromStringParser.safeParse( searchParams.get(PAGINATION_MAX_RESULTS_PARAM) ); - const DEFAULT_PAGINATION_CURRENT = 1; - const DEFAULT_PAGINATION_PAGE_SIZE = 10; - const DEFAULT_PAGINATION_TOTAL = 0; - const [paginationTotal, setPaginationTotal] = useState(DEFAULT_PAGINATION_TOTAL); - const paginationCurrent = paginationCurrentParsed.success - ? paginationCurrentParsed.data - : DEFAULT_PAGINATION_CURRENT; - const paginationPageSize = paginationPageSizeParsed.success - ? paginationPageSizeParsed.data - : DEFAULT_PAGINATION_PAGE_SIZE; + const paginationPage = paginationPageParsed.success + ? paginationPageParsed.data + : DEFAULT_PAGINATION_PAGE; + const paginationMaxResults = paginationMaxResultsParsed.success + ? paginationMaxResultsParsed.data + : DEFAULT_PAGINATION_MAX_RESULTS; const credentialsList = isAsyncTaskDataAvailable(credentials) ? credentials.data : []; const showDefaultContent = @@ -202,20 +201,20 @@ export function CredentialsTable() { ]; const updatePaginationParams = useCallback( - (pagination: { current?: number; pageSize?: number }) => { + (pagination: { maxResults?: number; page?: number }) => { setSearchParams((previousParams) => { const params = new URLSearchParams(previousParams); params.set( - PAGINATION_CURRENT_PARAM, - pagination.current !== undefined - ? pagination.current.toString() - : DEFAULT_PAGINATION_CURRENT.toString() + PAGINATION_PAGE_PARAM, + pagination.page !== undefined + ? pagination.page.toString() + : DEFAULT_PAGINATION_PAGE.toString() ); params.set( PAGINATION_MAX_RESULTS_PARAM, - pagination.pageSize !== undefined - ? pagination.pageSize.toString() - : DEFAULT_PAGINATION_PAGE_SIZE.toString() + pagination.maxResults !== undefined + ? pagination.maxResults.toString() + : DEFAULT_PAGINATION_MAX_RESULTS.toString() ); return params; }); @@ -234,8 +233,8 @@ export function CredentialsTable() { const response = await getCredentials({ env, params: { - max_results: paginationPageSize, - page: paginationCurrent, + max_results: paginationMaxResults, + page: paginationPage, query: queryParam || undefined, status: credentialStatus, }, @@ -248,8 +247,8 @@ export function CredentialsTable() { }); setPaginationTotal(response.data.meta.total); updatePaginationParams({ - current: response.data.meta.current, - pageSize: response.data.meta.max_results, + maxResults: response.data.meta.max_results, + page: response.data.meta.page, }); notifyParseErrors(response.data.items.failed); } else { @@ -260,8 +259,8 @@ export function CredentialsTable() { }, [ env, - paginationPageSize, - paginationCurrent, + paginationMaxResults, + paginationPage, queryParam, credentialStatus, updatePaginationParams, @@ -357,14 +356,14 @@ export function CredentialsTable() { ), }} - onChange={(pagination) => { - setPaginationTotal(pagination.total || DEFAULT_PAGINATION_TOTAL); - updatePaginationParams(pagination); + onChange={({ current, pageSize, total }) => { + setPaginationTotal(total || DEFAULT_PAGINATION_TOTAL); + updatePaginationParams({ maxResults: pageSize, page: current }); }} pagination={{ - current: paginationCurrent, + current: paginationPage, hideOnSinglePage: true, - pageSize: paginationPageSize, + pageSize: paginationMaxResults, position: ["bottomRight"], total: paginationTotal, }} diff --git a/ui/src/utils/constants.ts b/ui/src/utils/constants.ts index 15463d687..193f601c6 100644 --- a/ui/src/utils/constants.ts +++ b/ui/src/utils/constants.ts @@ -34,9 +34,13 @@ export const DID_SEARCH_PARAM = "did"; export const QUERY_SEARCH_PARAM = "query"; export const SCHEMA_SEARCH_PARAM = "schema"; export const STATUS_SEARCH_PARAM = "status"; -export const PAGINATION_CURRENT_PARAM = "current"; +export const PAGINATION_PAGE_PARAM = "page"; export const PAGINATION_MAX_RESULTS_PARAM = "max_results"; +export const DEFAULT_PAGINATION_PAGE = 1; +export const DEFAULT_PAGINATION_MAX_RESULTS = 10; +export const DEFAULT_PAGINATION_TOTAL = 0; + export const API_VERSION = "v1"; type CredentialsTab = { id: CredentialsTabIDs; tabID: string; title: string }; diff --git a/ui/src/utils/types.ts b/ui/src/utils/types.ts index 1dce18264..dcd2e2b17 100644 --- a/ui/src/utils/types.ts +++ b/ui/src/utils/types.ts @@ -1,8 +1,8 @@ import { z } from "zod"; export type Meta = { - current: number; max_results: number; + page: number; total: number; }; From 665e4a65c518aa0de94c64533b9ceec5deb9ce52 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Thu, 7 Dec 2023 11:41:42 +0100 Subject: [PATCH 005/110] Force page and maxResults URL params to positive integers --- ui/src/adapters/parsers/index.ts | 4 ++-- ui/src/components/credentials/CredentialsTable.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/src/adapters/parsers/index.ts b/ui/src/adapters/parsers/index.ts index 26f8bb69b..6f37dd6d4 100644 --- a/ui/src/adapters/parsers/index.ts +++ b/ui/src/adapters/parsers/index.ts @@ -69,11 +69,11 @@ export const datetimeParser = getStrictParser()( }) ); -export const numberFromStringParser = getStrictParser()( +export const positiveIntegerFromStringParser = getStrictParser()( z.string().transform((value, context) => { const trimmed = value.trim(); const valueToParse = trimmed === "" ? undefined : Number(trimmed); - const parsedNumber = z.number().safeParse(valueToParse); + const parsedNumber = z.number().int().min(1).safeParse(valueToParse); if (parsedNumber.success) { return parsedNumber.data; } else { diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index c4a35ae5a..258b91041 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -18,7 +18,7 @@ import { useCallback, useEffect, useState } from "react"; import { Link, generatePath, useNavigate, useSearchParams } from "react-router-dom"; import { credentialStatusParser, getCredentials } from "src/adapters/api/credentials"; -import { numberFromStringParser } from "src/adapters/parsers"; +import { positiveIntegerFromStringParser } from "src/adapters/parsers"; import IconCreditCardPlus from "src/assets/icons/credit-card-plus.svg?react"; import IconCreditCardRefresh from "src/assets/icons/credit-card-refresh.svg?react"; import IconDots from "src/assets/icons/dots-vertical.svg?react"; @@ -74,10 +74,10 @@ export function CredentialsTable() { const parsedStatusParam = credentialStatusParser.safeParse(statusParam); const credentialStatus = parsedStatusParam.success ? parsedStatusParam.data : "all"; - const paginationPageParsed = numberFromStringParser.safeParse( + const paginationPageParsed = positiveIntegerFromStringParser.safeParse( searchParams.get(PAGINATION_PAGE_PARAM) ); - const paginationMaxResultsParsed = numberFromStringParser.safeParse( + const paginationMaxResultsParsed = positiveIntegerFromStringParser.safeParse( searchParams.get(PAGINATION_MAX_RESULTS_PARAM) ); From b538e28ecd616ef4de3a5cbf6abb467d02e57f00 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Thu, 7 Dec 2023 11:46:03 +0100 Subject: [PATCH 006/110] Force resource meta props to positive integers --- ui/src/adapters/parsers/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/adapters/parsers/index.ts b/ui/src/adapters/parsers/index.ts index 6f37dd6d4..f4645ee84 100644 --- a/ui/src/adapters/parsers/index.ts +++ b/ui/src/adapters/parsers/index.ts @@ -37,9 +37,9 @@ export function getListParser( const metaParser = getStrictParser()( z.object({ - max_results: z.number(), - page: z.number(), - total: z.number(), + max_results: z.number().int().min(1), + page: z.number().int().min(1), + total: z.number().int().min(0), }) ); From 65ed01e887d11df7150ad75ad3a20c382be632e8 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Thu, 14 Dec 2023 18:53:13 +0100 Subject: [PATCH 007/110] Show actual total in issued tag --- ui/src/components/credentials/CredentialsTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index 258b91041..dcbd9dbf6 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -377,7 +377,7 @@ export function CredentialsTable() { - {credentialsList.length} + {paginationTotal} {(!showDefaultContent || credentialStatus !== "all") && ( From aa6a0846c04d21f07efab7bb6937471f795de028 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 29 Dec 2023 16:30:35 +0100 Subject: [PATCH 008/110] chore: update go version to 1.21 and modules to latest --- go.mod | 123 ++++++++-------- go.sum | 455 +++++++++++++++++++++++++++++++++------------------------ 2 files changed, 331 insertions(+), 247 deletions(-) diff --git a/go.mod b/go.mod index fa325a8e0..cb35aaa77 100644 --- a/go.mod +++ b/go.mod @@ -1,26 +1,26 @@ module github.com/polygonid/sh-id-platform -go 1.20 +go 1.21 require ( github.com/alicebob/miniredis/v2 v2.31.0 github.com/deepmap/oapi-codegen v1.16.2 - github.com/ethereum/go-ethereum v1.13.4 - github.com/getkin/kin-openapi v0.120.0 - github.com/go-chi/chi/v5 v5.0.10 + github.com/ethereum/go-ethereum v1.13.8 + github.com/getkin/kin-openapi v0.122.0 + github.com/go-chi/chi/v5 v5.0.11 github.com/go-chi/cors v1.2.1 github.com/go-redis/cache/v8 v8.4.4 github.com/go-redis/redis/v8 v8.11.5 github.com/golangci/golangci-lint v1.55.2 - github.com/google/uuid v1.4.0 + github.com/google/uuid v1.5.0 github.com/hashicorp/go-retryablehttp v0.7.5 github.com/hashicorp/vault/api v1.10.0 github.com/hashicorp/vault/api/auth/userpass v0.5.0 - github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0 + github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20231116131043-966af42c9b58 github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f github.com/iden3/go-circuits/v2 v2.0.0 - github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 - github.com/iden3/go-iden3-core/v2 v2.0.0 + github.com/iden3/go-iden3-auth/v2 v2.0.0 + github.com/iden3/go-iden3-core/v2 v2.0.3 github.com/iden3/go-iden3-crypto v0.0.15 github.com/iden3/go-jwz/v2 v2.0.0 github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 @@ -39,21 +39,23 @@ require ( github.com/jackc/pgx/v4 v4.18.1 github.com/jmoiron/sqlx v1.3.5 github.com/joho/godotenv v1.5.1 - github.com/labstack/gommon v0.4.0 + github.com/labstack/gommon v0.4.2 github.com/lib/pq v1.10.9 github.com/mitchellh/mapstructure v1.5.0 github.com/mr-tron/base58 v1.2.0 - github.com/oapi-codegen/runtime v1.0.0 + github.com/oapi-codegen/runtime v1.1.0 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/pkg/errors v0.9.1 - github.com/pressly/goose/v3 v3.15.1 - github.com/spf13/viper v1.17.0 + github.com/pressly/goose/v3 v3.17.0 + github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 - golang.org/x/crypto v0.15.0 - golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 + golang.org/x/crypto v0.17.0 + golang.org/x/exp v0.0.0-20231226003508-02704c960a9b ) +require github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect @@ -69,7 +71,7 @@ require ( github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect - github.com/VictoriaMetrics/fastcache v1.12.1 // indirect + github.com/VictoriaMetrics/fastcache v1.12.2 // indirect github.com/alecthomas/go-check-sumtype v0.1.3 // indirect github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect @@ -80,7 +82,7 @@ require ( github.com/ashanbrown/makezero v1.1.1 // indirect github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.9.0 // indirect + github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect @@ -100,36 +102,36 @@ require ( github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect github.com/cockroachdb/redact v1.1.5 // indirect - github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect - github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect - github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect + github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041 // indirect + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.11.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dchest/blake512 v1.0.0 // indirect - github.com/deckarep/golang-set/v2 v2.3.1 // indirect + github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 // indirect github.com/esimonov/ifshort v1.0.4 // indirect - github.com/ethereum/c-kzg-4844 v0.3.1 // indirect + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/ettle/strcase v0.1.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect + github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect github.com/getsentry/sentry-go v0.25.0 // indirect github.com/ghostiam/protogetter v0.2.3 // indirect github.com/go-critic/go-critic v0.9.0 // indirect - github.com/go-jose/go-jose/v3 v3.0.0 // indirect + github.com/go-jose/go-jose/v3 v3.0.1 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.20.0 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/swag v0.22.4 // indirect - github.com/go-stack/stack v1.8.1 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -142,7 +144,6 @@ require ( github.com/goccy/go-json v0.10.2 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect @@ -155,7 +156,7 @@ require ( github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect - github.com/gorilla/websocket v1.5.0 // indirect + github.com/gorilla/websocket v1.5.1 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect @@ -164,26 +165,26 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect - github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect - github.com/hashicorp/go-sockaddr v1.0.5 // indirect + github.com/hashicorp/go-sockaddr v1.0.6 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.3 // indirect + github.com/holiman/uint256 v1.2.4 // indirect github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48 // indirect github.com/iden3/go-iden3-core v1.0.2 // indirect github.com/iden3/go-rapidsnark/verifier v0.0.5 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/invopop/yaml v0.2.0 // indirect - github.com/ipfs/boxo v0.13.1 // indirect + github.com/ipfs/boxo v0.16.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgproto3/v2 v2.3.2 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect github.com/jackc/puddle v1.3.0 // indirect github.com/jgautheron/goconst v1.6.0 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect @@ -193,8 +194,8 @@ require ( github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect - github.com/klauspost/compress v1.17.0 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/compress v1.17.4 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/kulti/thelper v0.6.3 // indirect @@ -207,11 +208,11 @@ require ( github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httprc v1.0.4 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/jwx/v2 v2.0.13 // indirect + github.com/lestrrat-go/jwx/v2 v2.0.18 // indirect github.com/lestrrat-go/option v1.0.1 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.31.0 // indirect + github.com/libp2p/go-libp2p v0.32.2 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/macabu/inamedparam v0.1.2 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -220,9 +221,9 @@ require ( github.com/maratori/testpackage v1.1.1 // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.4 // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -232,7 +233,7 @@ require ( github.com/moricho/tparallel v0.3.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.11.0 // indirect + github.com/multiformats/go-multiaddr v0.12.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect @@ -243,25 +244,25 @@ require ( github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.14.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polyfloyd/go-errorlint v1.4.5 // indirect github.com/pquerna/cachecontrol v0.2.0 // indirect - github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.4.4 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect - github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect @@ -269,6 +270,7 @@ require ( github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect github.com/securego/gosec/v2 v2.18.2 // indirect github.com/segmentio/asm v1.2.0 // indirect + github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.9.3 // indirect @@ -279,33 +281,34 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/afero v1.10.0 // indirect - github.com/spf13/cast v1.5.1 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect - github.com/stretchr/objx v0.5.1 // indirect + github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.11 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.15 // indirect - github.com/tetratelabs/wazero v1.5.0 // indirect + github.com/tetratelabs/wazero v1.6.0 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect - github.com/tklauser/go-sysconf v0.3.12 // indirect - github.com/tklauser/numcpus v0.6.1 // indirect + github.com/tklauser/go-sysconf v0.3.13 // indirect + github.com/tklauser/numcpus v0.7.0 // indirect github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.0.5 // indirect github.com/uudashr/gocognit v1.1.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect github.com/vmihailenco/go-tinylfu v0.2.2 // indirect - github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect @@ -317,17 +320,17 @@ require ( go-simpler.org/sloglint v0.1.2 // indirect go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.25.0 // indirect - golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9 // indirect + go.uber.org/zap v1.26.0 // indirect + golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.15.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect + golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.16.1 // indirect + google.golang.org/protobuf v1.32.0 // indirect + gopkg.in/go-jose/go-jose.v2 v2.6.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -336,6 +339,6 @@ require ( mvdan.cc/gofumpt v0.5.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect - mvdan.cc/unparam v0.0.0-20230815095028-f7c6fb1088f0 // indirect + mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 33d42f6ca..c9ca687dd 100644 --- a/go.sum +++ b/go.sum @@ -7,7 +7,6 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -18,9 +17,6 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -38,7 +34,6 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/4meepo/tagalign v1.3.3 h1:ZsOxcwGD/jP4U/aw7qeWu58i7dwYemfy5Y+IF1ACoNw= github.com/4meepo/tagalign v1.3.3/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= @@ -50,10 +45,16 @@ github.com/Antonboom/nilnil v0.1.7 h1:ofgL+BA7vlA1K2wNQOsHzLJ2Pw5B5DpWRLdDAVvvTo github.com/Antonboom/nilnil v0.1.7/go.mod h1:TP+ScQWVEq0eSIxqU8CbdT5DFWoHp0MbP+KMUO1BKYQ= github.com/Antonboom/testifylint v0.2.3 h1:MFq9zyL+rIVpsvLX4vDPLojgN7qODzWsrnftNX2Qh60= github.com/Antonboom/testifylint v0.2.3/go.mod h1:IYaXaOX9NbfAyO+Y04nfjGI8wDemC1rUyM/cYolz018= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ClickHouse/ch-go v0.58.2 h1:jSm2szHbT9MCAB1rJ3WuCJqmGLi5UTjlNu+f530UTS0= +github.com/ClickHouse/ch-go v0.58.2/go.mod h1:Ap/0bEmiLa14gYjCiRkYGbXvbe8vwdrfTYWhsuQ99aw= +github.com/ClickHouse/clickhouse-go/v2 v2.16.0 h1:rhMfnPewXPnY4Q4lQRGdYuTLRBRKJEIEYHtbUMrzmvI= +github.com/ClickHouse/clickhouse-go/v2 v2.16.0/go.mod h1:J7SPfIxwR+x4mQ+o8MLSe0oY50NNntEqCIjFe/T1VPM= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= @@ -66,15 +67,19 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0 github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= -github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= -github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= +github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= +github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= +github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/go-check-sumtype v0.1.3 h1:M+tqMxB68hcgccRXBMVCPI4UJ+QUfdSx0xdbypKCqA8= github.com/alecthomas/go-check-sumtype v0.1.3/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= +github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -92,6 +97,8 @@ github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQ github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI= +github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= @@ -106,8 +113,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.9.0 h1:g1YivPG8jOtrN013Fe8OBXubkiTwvm7/vG2vXz03ANU= -github.com/bits-and-blooms/bitset v1.9.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= +github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bkielbasa/cyclop v1.2.1 h1:AeF71HZDob1P2/pRm1so9cd1alZnrpyc4q2uP2l0gJY= github.com/bkielbasa/cyclop v1.2.1/go.mod h1:K/dT/M0FPAiYjBgQGau7tz+3TMh4FWAEqlMhzFWCrgM= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= @@ -122,10 +129,13 @@ github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqv github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= github.com/btcsuite/btcd v0.23.3 h1:4KH/JKy9WiCd+iUS9Mu0Zp7Dnj17TGdKrg9xc/FGj24= +github.com/btcsuite/btcd v0.23.3/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/butuzov/ireturn v0.2.2 h1:jWI36dxXwVrI+RnXDwux2IZOewpmfv930OuIRfaBUJ0= github.com/butuzov/ireturn v0.2.2/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk= github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= @@ -137,8 +147,11 @@ github.com/ccojocar/zxcvbn-go v1.0.1/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQd github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -148,16 +161,16 @@ github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoG github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= +github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= @@ -172,14 +185,18 @@ github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/Yj github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= +github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= -github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= -github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= -github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= +github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 h1:ZFUue+PNxmHlu7pYv+IYMtqlaO/0VwaGEqKepZf9JpA= +github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= +github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041 h1:44imsFSR7HcR8VTSDNDAnm8QecxYbSmeOGAqPflRsyI= +github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= +github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= @@ -192,8 +209,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/blake512 v1.0.0 h1:oDFEQFIqFSeuA34xLtXZ/rWxCXdSjirjzPhey5EUvmA= github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzhLMB92JI= -github.com/deckarep/golang-set/v2 v2.3.1 h1:vjmkvJt/IV27WXPyYQpAh4bRyWJc5Y435D17XQ9QU5A= -github.com/deckarep/golang-set/v2 v2.3.1/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= +github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= @@ -204,21 +221,32 @@ github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20 github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= +github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 h1:I6KUy4CI6hHjqnyJLNCEi7YHVMkwwtfSr2k9splgdSM= github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564/go.mod h1:yekO+3ZShy19S+bsmnERmznGy9Rfg6dWWWpiGJjNAz8= +github.com/elastic/go-sysinfo v1.11.2 h1:mcm4OSYVMyws6+n2HIVMGkln5HOpo5Ie1ZmbbNn0jg4= +github.com/elastic/go-sysinfo v1.11.2/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= +github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0= +github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= -github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= -github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.13.4 h1:25HJnaWVg3q1O7Z62LaaI6S9wVq8QCw3K88g8wEzrcM= -github.com/ethereum/go-ethereum v1.13.4/go.mod h1:I0U5VewuuTzvBtVzKo7b3hJzDhXOUtn9mJW7SsIPB0Q= +github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= +github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.13.8 h1:1od+thJel3tM52ZUNQwvpYOeRHlbkVFZ5S8fhi0Lgsg= +github.com/ethereum/go-ethereum v1.13.8/go.mod h1:sc48XYQxCzH3fG9BcrXCOOgQk2JfZzNAmIKnceogzsA= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -229,32 +257,43 @@ github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4 github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/getkin/kin-openapi v0.120.0 h1:MqJcNJFrMDFNc07iwE8iFC5eT2k/NPUFDIpNeiZv8Jg= -github.com/getkin/kin-openapi v0.120.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= +github.com/getkin/kin-openapi v0.122.0 h1:WB9Jbl0Hp/T79/JF9xlSW5Kl9uYdk/AWD0yAd9HOM10= +github.com/getkin/kin-openapi v0.122.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghostiam/protogetter v0.2.3 h1:qdv2pzo3BpLqezwqfGDLZ+nHEYmc5bUpIdsMbBVwMjw= github.com/ghostiam/protogetter v0.2.3/go.mod h1:KmNLOsy1v04hKbvZs8EfGI1fk39AgTdRDxWNYPfXVc4= -github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= -github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= +github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczKGV/U= github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= +github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw= +github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI= +github.com/go-faster/errors v0.6.1/go.mod h1:5MGV2/2T9yvlrbhe9pD9LO5Z/2zCSq2T8j+Jpi2LAyY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= +github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= +github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -262,11 +301,13 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= -github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-redis/cache/v8 v8.4.4 h1:Rm0wZ55X22BA2JMqVtRQNHYyzDd0I5f+Ec/C9Xx3mXY= @@ -276,13 +317,14 @@ github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= -github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= @@ -295,6 +337,7 @@ github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlN github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= github.com/go-toolsmith/pkgload v1.2.2 h1:0CtmHq/02QhxcF7E9N5LIFcYFsMR5rdovfqTtRKkgIk= +github.com/go-toolsmith/pkgload v1.2.2/go.mod h1:R2hxLNRKuAsiXCo2i5J6ZQPhnPMOVtU+f0arbFPWCus= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= @@ -311,11 +354,13 @@ github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14j github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -329,6 +374,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -388,9 +434,10 @@ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -398,22 +445,20 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f h1:pDhu5sgp8yJlEF/g6osliIIpF9K4F5jvkULXa4daRDQ= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 h1:mrEEilTAUmaAORhssPPkxj84TsHrPMLBGW2Z4SoTxm8= github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= @@ -425,16 +470,19 @@ github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3 github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= +github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= @@ -444,14 +492,14 @@ github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5 github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= -github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs= -github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 h1:iBt4Ew4XEGLfh6/bPk4rSYmuZJGizr6/x/AEizP0CQc= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8/go.mod h1:aiJI+PIApBRQG7FZTEBx5GiiX+HbOHilUdNxUZi4eV0= github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= -github.com/hashicorp/go-sockaddr v1.0.5 h1:dvk7TIXCZpmfOlM+9mlcrWmWjw/wlKT+VDq2wMvfPJU= -github.com/hashicorp/go-sockaddr v1.0.5/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= +github.com/hashicorp/go-sockaddr v1.0.6 h1:RSG8rKU28VTUTvEKghe5gIhIQpv8evvNpnDEyqO4u9I= +github.com/hashicorp/go-sockaddr v1.0.6/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -466,28 +514,29 @@ github.com/hashicorp/vault/api/auth/userpass v0.5.0/go.mod h1:TNxl3X6ZaeILi1rfxP github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= -github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0 h1:Fu1/tAINi9FzZ0nKoEVOGXWzL1l15tR1loJx5sQEQ8k= -github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0/go.mod h1:8fkd2xyUG/V7ovpvZRyD2LyK2zZ4ALbgf5vJGyhzKdg= +github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20231116131043-966af42c9b58 h1:nFUQYA0AhCS/SvAP1wAQFQWF/rR/EIEfTRke0xdwONY= +github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20231116131043-966af42c9b58/go.mod h1:8fkd2xyUG/V7ovpvZRyD2LyK2zZ4ALbgf5vJGyhzKdg= github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48 h1:/g4rru+OM5WAhVNXEpowKH+vWZLGjgpk5+O8Stu4QBo= github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48/go.mod h1:kJmVPMk4HfWyl2kcta34aad/K4TAfCwB29xX9PsR7LQ= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f h1:aTYEBIh802oWF6B3jhXf5F7UVGxfPJG70shYkRXzb+s= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= github.com/iden3/go-circuits/v2 v2.0.0 h1:Bw0mpsqeip06d6I2ktgfhTVB7Jk9mSHi8myHZWkoc6w= github.com/iden3/go-circuits/v2 v2.0.0/go.mod h1:VIFIp51+IH0hOzjnKhb84bCeyq7hq76zX/C14ua6zh4= -github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 h1:r5vjH+MyPFzaJ7U62SO5Gz9N9O0RZfDORNHVd9JymNg= -github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2/go.mod h1:bYr47aev7sh23RL7Ru+TQQSlYDS94+wO8P8SDrwdifc= +github.com/iden3/go-iden3-auth/v2 v2.0.0 h1:DMrnmBY2lGhLjI6jLK2AE42FMIlgQc+vbeM+fW79Ge4= +github.com/iden3/go-iden3-auth/v2 v2.0.0/go.mod h1:bYr47aev7sh23RL7Ru+TQQSlYDS94+wO8P8SDrwdifc= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= -github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA= -github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= +github.com/iden3/go-iden3-core/v2 v2.0.3 h1:ce9Jbw10zDsinWXFc05SiK2Hof/wu4zV4/ai5gQy29k= +github.com/iden3/go-iden3-core/v2 v2.0.3/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= github.com/iden3/go-jwz/v2 v2.0.0 h1:VsU2PrmcchPMx/V0IhamMZRNjiQYZoyJopO8K8uSZOY= @@ -514,12 +563,14 @@ github.com/iden3/iden3comm/v2 v2.0.0 h1:cFDfF6aJ589ENg5zlTBEPK6Qqv4I11C/gliAWZOR github.com/iden3/iden3comm/v2 v2.0.0/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= github.com/iden3/merkletree-proof v0.0.4/go.mod h1:D49CVDG/tshMiZuDCxWjGJoNplRg9y9XIlg9/eMSYOc= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= -github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= -github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= +github.com/ipfs/boxo v0.16.0 h1:A9dUmef5a+mEFki6kbyG7el5gl65CiUBzrDeZxzTWKY= +github.com/ipfs/boxo v0.16.0/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-ipfs-api v0.7.0 h1:CMBNCUl0b45coC+lQCXEVpMhwoqjiaCwUIrM+coYW2Q= @@ -555,8 +606,9 @@ github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwX github.com/jackc/pgproto3/v2 v2.3.2 h1:7eY55bdBeCz1F2fTzSz69QC+pG46jYq9/jtSPiJ5nn0= github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA= +github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= @@ -569,12 +621,17 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.18.1 h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0= github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE= +github.com/jackc/pgx/v5 v5.5.1 h1:5I9etrGkLrN+2XPCsi6XLlV5DITbSL/xBZdmAxFcXPI= +github.com/jackc/pgx/v5 v5.5.1/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0= github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jgautheron/goconst v1.6.0 h1:gbMLWKRMkzAc6kYsQL6/TxaoBUg3Jm9LSF/Ih1ADWGA= github.com/jgautheron/goconst v1.6.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= @@ -583,8 +640,12 @@ github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9B github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= +github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= +github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -600,6 +661,7 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= @@ -608,16 +670,16 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= +github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -631,15 +693,17 @@ github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dq github.com/kunwardeep/paralleltest v1.0.8 h1:Ul2KsqtzFxTlSU7IP0JusWlLiNqQaloB9vguyjbE558= github.com/kunwardeep/paralleltest v1.0.8/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= -github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= -github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= +github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N+AkAr5k= @@ -650,8 +714,8 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.13 h1:XdxzJbudGaHEoNmyJACAT8aFCB+DmviiaiMoZwuJoUo= -github.com/lestrrat-go/jwx/v2 v2.0.13/go.mod h1:UzXMzcV99p9/xe1JsIb336NJDGXLsleR+Qj3ucEDtfI= +github.com/lestrrat-go/jwx/v2 v2.0.18 h1:HHZkYS5wWDDyAiNBwztEtDoX07WDhGEdixm8G06R50o= +github.com/lestrrat-go/jwx/v2 v2.0.18/go.mod h1:fAJ+k5eTgKdDqanzCuK6DAt3W7n3cs2/FX7JhQdk83U= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= @@ -665,8 +729,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6 github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.31.0 h1:LFShhP8F6xthWiBBq3euxbKjZsoRajVEyBS9snfHxYg= -github.com/libp2p/go-libp2p v0.31.0/go.mod h1:W/FEK1c/t04PbRH3fA9i5oucu5YcgrG0JVoBWT1B7Eg= +github.com/libp2p/go-libp2p v0.32.2 h1:s8GYN4YJzgUoyeYNPdW7JZeZ5Ee31iNaIBfGYMAY4FQ= +github.com/libp2p/go-libp2p v0.32.2/go.mod h1:E0LKe+diV/ZVJVnOJby8VC5xzHF0660osg71skcxJvk= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/macabu/inamedparam v0.1.2 h1:RR5cnayM6Q7cDhQol32DE2BGAPGMnffJ31LFE+UklaU= @@ -687,7 +751,6 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -696,18 +759,17 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/revive v1.3.4 h1:k/tO3XTaWY4DEHal9tWBkkUMJYO/dLDVyMmAQxmIMDc= @@ -722,9 +784,12 @@ github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -740,8 +805,8 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= -github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= +github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= +github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= @@ -765,34 +830,52 @@ github.com/nunnatsa/ginkgolinter v0.14.1/go.mod h1:nY0pafUSst7v7F637e7fymaMlQqI9 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oapi-codegen/runtime v1.0.0 h1:P4rqFX5fMFWqRzY9M/3YF9+aPSPPB06IzP2P7oOxrWo= -github.com/oapi-codegen/runtime v1.0.0/go.mod h1:LmCUMQuPB4M/nLXilQXhHw+BLZdDb18B34OO356yJ/A= +github.com/oapi-codegen/runtime v1.1.0 h1:rJpoNUawn5XTvekgfkvSZr0RqEnoYpFkyvrzfWeFKWM= +github.com/oapi-codegen/runtime v1.1.0/go.mod h1:BeSfBkWWWnAnGdyS+S/GnlbmHKzf8/hwkvelJZDeKA8= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/olomix/go-test-pg v1.0.2 h1:4ey3mFBhPx93PdgyshOJI1WrQzqzkWEnb0wL/7UbFMI= +github.com/olomix/go-test-pg v1.0.2/go.mod h1:rHMame/S99rnU5YhVYFa3rr0riKqBYe8xsMDP4YzeHA= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= +github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/runc v1.1.10 h1:EaL5WeO9lv9wmS6SASjszOeQdSctvpbu0DdBQBizE40= +github.com/opencontainers/runc v1.1.10/go.mod h1:+/R6+KmDlh+hOO8NkjmgkG9Qzvypzk0yXxAPYYR65+M= +github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= +github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.11.0 h1:OKBD80J/mLBrwnzXqGtFCzprFSGioo30JcmR4APsNwc= +github.com/otiai10/copy v1.11.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/paulmach/orb v0.10.0 h1:guVYVqzxHE/CQ1KpfGO077TR0ATHSNjp4s6XGLn3W9s= +github.com/paulmach/orb v0.10.0/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= +github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= +github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f h1:HlPa7RcxTCrva5izPfTEfvYecO7LTahgmMRD1Qp13xg= github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f/go.mod h1:WZ501QQMbZZ+3pXFPhQKzNwS1+jls0oqov3uQ2WasLs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -800,7 +883,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -809,15 +891,15 @@ github.com/polyfloyd/go-errorlint v1.4.5/go.mod h1:sIZEbFoDOCnTYYZoVkjc4hTnM459t github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/pquerna/cachecontrol v0.2.0 h1:vBXSNuE5MYP9IJ5kjsdo8uq+w41jSPgvba2DEnkRx9k= github.com/pquerna/cachecontrol v0.2.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI= -github.com/pressly/goose/v3 v3.15.1 h1:dKaJ1SdLvS/+HtS8PzFT0KBEtICC1jewLXM+b3emlv8= -github.com/pressly/goose/v3 v3.15.1/go.mod h1:0E3Yg/+EwYzO6Rz2P98MlClFgIcoujbVRs575yi3iIM= +github.com/pressly/goose/v3 v3.17.0 h1:fT4CL3LRm4kfyLuPWzDFAoxjR5ZHjeJ6uQhibQtBaIs= +github.com/pressly/goose/v3 v3.17.0/go.mod h1:22aw7NpnCPlS86oqkO/+3+o9FuCaJg4ZVWRUO3oGzHQ= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -828,8 +910,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -846,15 +928,17 @@ github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:r github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= @@ -867,8 +951,8 @@ github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDj github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= -github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= @@ -884,6 +968,8 @@ github.com/securego/gosec/v2 v2.18.2 h1:DkDt3wCiOtAHf1XkiXZBhQ6m6mK/b9T/wD257R3/ github.com/securego/gosec/v2 v2.18.2/go.mod h1:xUuqSF6i0So56Y2wwohWAmB07EdBkUN6crbLlHwbyJs= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/sethvargo/go-retry v0.2.4 h1:T+jHEQy/zKJf5s95UkguisicE0zuF9y7+/vgz08Ocec= +github.com/sethvargo/go-retry v0.2.4/go.mod h1:1afjQuvh7s4gflMObvjLPaWgluLLyhA1wmVZ6KLpICw= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= @@ -891,6 +977,7 @@ github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -913,29 +1000,29 @@ github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCp github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= -github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= -github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= -github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -945,7 +1032,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -964,46 +1050,61 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.15 h1:QzdIs+XB8q+U1WmQEWKHQbKmCw06QuQM7gLx/dky2RM= github.com/tetafro/godot v1.4.15/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= -github.com/tetratelabs/wazero v1.5.0 h1:Yz3fZHivfDiZFUXnWMPUoiW7s8tC1sjdBtlJn08qYa0= -github.com/tetratelabs/wazero v1.5.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= +github.com/tetratelabs/wazero v1.6.0 h1:z0H1iikCdP8t+q341xqepY4EWvHEw8Es7tlqiVzlP3g= +github.com/tetratelabs/wazero v1.6.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= +github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= +github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= +github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQpIXDJRhQ= github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2Uow/Vdm9NQcl5SE= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= github.com/uudashr/gocognit v1.1.2/go.mod h1:aAVdLURqcanke8h3vg35BC++eseDm66Z7KmchI5et4k= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/vertica/vertica-sql-go v1.3.3 h1:fL+FKEAEy5ONmsvya2WH5T8bhkvY27y/Ik3ReR2T+Qw= +github.com/vertica/vertica-sql-go v1.3.3/go.mod h1:jnn2GFuv+O2Jcjktb7zyc4Utlbu9YVqpHH/lx63+1M4= github.com/vmihailenco/go-tinylfu v0.2.2 h1:H1eiG6HM36iniK6+21n9LLpzx1G9R3DJa2UjUjbynsI= github.com/vmihailenco/go-tinylfu v0.2.2/go.mod h1:CutYi2Q9puTxfcolkliPq4npPuofg9N9t8JVrjzwa3Q= github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608= -github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd h1:dzWP1Lu+A40W883dK/Mr3xyDSM/2MggS8GtHT0qgAnE= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= +github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2 h1:E0yUuuX7UmPxXm92+yQCjMveLFO3zfvYFIJVuAqsVRA= +github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2/go.mod h1:fjBLQ2TdQNl4bMjuWl9adoTGBypwUTPoGC+EqYqiIcU= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= github.com/ykadowak/zerologlint v0.1.3 h1:TLy1dTW3Nuc+YE3bYRPToG1Q9Ej78b5UUN6bjbGdxPE= @@ -1023,6 +1124,7 @@ github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxt gitlab.com/bosi/decorder v0.4.1 h1:VdsdfxhstabyhZovHafFw+9eJ6eU0d2CkFNJcZz/NU4= gitlab.com/bosi/decorder v0.4.1/go.mod h1:jecSqWUew6Yle1pCr2eLWTensJMmsxHsBwt+PVbkAqA= go-simpler.org/assert v0.6.0 h1:QxSrXa4oRuo/1eHMXSBFHKvJIpWABayzKldqZyugG7E= +go-simpler.org/assert v0.6.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= go-simpler.org/sloglint v0.1.2 h1:IjdhF8NPxyn0Ckn2+fuIof7ntSnVUAqBFcQRrnG9AiM= go-simpler.org/sloglint v0.1.2/go.mod h1:2LL+QImPfTslD5muNPydAEYmpXIj6o/WYcqnJjLi4o4= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -1030,7 +1132,10 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= +go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= +go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= go.tmz.dev/musttag v0.7.2 h1:1J6S9ipDbalBSODNT5jCep8dhZyMr4ttnjQagmGYR5s= go.tmz.dev/musttag v0.7.2/go.mod h1:m6q5NiiSKMnQYokefa2xGoyoXnrswCbJ0AWYzf4Zs28= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1038,6 +1143,7 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -1047,8 +1153,8 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= -go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -1059,16 +1165,14 @@ golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1079,12 +1183,12 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w= -golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4= +golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9 h1:j3D9DvWRpUfIyFfDPws7LoIZ2MAI1OJHdQXtTnYtN+k= -golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= +golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1097,8 +1201,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -1107,7 +1211,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= @@ -1151,15 +1254,11 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= @@ -1167,17 +1266,13 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1240,25 +1335,17 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1267,17 +1354,15 @@ golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1286,7 +1371,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1299,15 +1384,14 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -1361,16 +1445,10 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= @@ -1384,8 +1462,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1408,16 +1486,12 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1447,13 +1521,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1466,10 +1536,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1482,21 +1550,23 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U= -gopkg.in/go-jose/go-jose.v2 v2.6.1/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= +gopkg.in/go-jose/go-jose.v2 v2.6.2 h1:Rl5+9rA0kG3vsO1qhncMPRT5eHICihAMQYJkD7u/i4M= +gopkg.in/go-jose/go-jose.v2 v2.6.2/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1507,7 +1577,6 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -1520,26 +1589,38 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8= honnef.co/go/tools v0.4.6/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= +howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= +howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo= +lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= modernc.org/cc/v3 v3.41.0 h1:QoR1Sn3YWlmA1T4vLaKZfawdVtSiGx8H+cEojbC7v1Q= +modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y= modernc.org/ccgo/v3 v3.16.15 h1:KbDR3ZAVU+wiLyMESPtbtE/Add4elztFyfsWoNTgxS0= -modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= +modernc.org/ccgo/v3 v3.16.15/go.mod h1:yT7B+/E2m43tmMOT51GMoM98/MtHIcQQSleGnddkUNI= +modernc.org/libc v1.32.0 h1:yXatHTrACp3WaKNRCoZwUK7qj5V8ep1XyY0ka4oYcNc= +modernc.org/libc v1.32.0/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= +modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= -modernc.org/sqlite v1.26.0 h1:SocQdLRSYlA8W99V8YH0NES75thx19d9sB/aFc4R8Lw= +modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= +modernc.org/sqlite v1.28.0 h1:Zx+LyDDmXczNnEQdvPuEfcFVA2ZPyaD7UCZDjef3BHQ= +modernc.org/sqlite v1.28.0/go.mod h1:Qxpazz0zH8Z1xCFyi5GSL3FzbtZ3fvbjmywNogldEW0= modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= +modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= +modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E= mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20230815095028-f7c6fb1088f0 h1:NAENkqZ+Xofhqs4R4Af+i3HpZj1M23SFn/lHfRh1D4E= -mvdan.cc/unparam v0.0.0-20230815095028-f7c6fb1088f0/go.mod h1:flQN1deud3vIpPdF88533Lpp/MvzGLgPIPjB1kgBf4I= +mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w= +mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 8da5900d230fb6e8023b54ab7e709348618ca79d Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 29 Dec 2023 17:53:15 +0100 Subject: [PATCH 009/110] chore: Use standard slog package instead of experimental old one. --- cmd/issuer_initializer/main.go | 10 ++-- cmd/migrate/main.go | 9 ++-- cmd/notifications/main.go | 10 ++-- cmd/pending_publisher/main.go | 11 +++-- cmd/platform/main.go | 10 ++-- cmd/platform_ui/main.go | 10 ++-- internal/api/main_test.go | 1 + internal/api/middleware.go | 3 +- internal/api/server_test.go | 4 +- internal/api_ui/main_test.go | 1 + internal/api_ui/middleware.go | 3 +- internal/api_ui/server_test.go | 42 ++++++++-------- internal/core/services/tests/main_test.go | 1 + .../core/services/tests/notification_test.go | 4 +- internal/loader/cache.go | 2 +- internal/log/log.go | 48 +++++++------------ internal/repositories/tests/main_test.go | 7 ++- pkg/http/client.go | 2 +- tools/vault-migrator/main.go | 4 +- 19 files changed, 89 insertions(+), 93 deletions(-) diff --git a/cmd/issuer_initializer/main.go b/cmd/issuer_initializer/main.go index f4a996292..df808e3a5 100644 --- a/cmd/issuer_initializer/main.go +++ b/cmd/issuer_initializer/main.go @@ -35,15 +35,17 @@ const ( ) func main() { - log.Info(context.Background(), "starting issuer node...", "revision", build) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + log.Info(ctx, "starting issuer node...", "revision", build) cfg, err := config.Load("") if err != nil { - log.Error(context.Background(), "cannot load config", "err", err) + log.Error(ctx, "cannot load config", "err", err) return } - ctx, cancel := context.WithCancel(log.NewContext(context.Background(), cfg.Log.Level, cfg.Log.Mode, os.Stdout)) - defer cancel() + log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) if err := cfg.Sanitize(ctx); err != nil { log.Error(ctx, "there are errors in the configuration that prevent server to start", "err", err) diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go index 4f72e4c56..6341b7941 100644 --- a/cmd/migrate/main.go +++ b/cmd/migrate/main.go @@ -12,12 +12,15 @@ import ( ) func main() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + cfg, err := config.Load("") if err != nil { - log.Error(context.Background(), "cannot load config", "err", err) + log.Error(ctx, "cannot load config", "err", err) } - // Context with log - ctx := log.NewContext(context.Background(), cfg.Log.Level, cfg.Log.Mode, os.Stdout) + + log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) log.Debug(ctx, "database", "url", cfg.Database.URL) if err := schema.Migrate(cfg.Database.URL); err != nil { diff --git a/cmd/notifications/main.go b/cmd/notifications/main.go index d58b47932..60d33e777 100644 --- a/cmd/notifications/main.go +++ b/cmd/notifications/main.go @@ -36,16 +36,18 @@ import ( var build = buildinfo.Revision() func main() { - log.Info(context.Background(), "starting issuer node...", "revision", build) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + log.Info(ctx, "starting issuer node...", "revision", build) cfg, err := config.Load("") if err != nil { - log.Error(context.Background(), "cannot load config", "err", err) + log.Error(ctx, "cannot load config", "err", err) return } - ctx, cancel := context.WithCancel(log.NewContext(context.Background(), cfg.Log.Level, cfg.Log.Mode, os.Stdout)) - defer cancel() + log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) if err := cfg.SanitizeAPIUI(ctx); err != nil { log.Error(ctx, "there are errors in the configuration that prevent server to start", "err", err) diff --git a/cmd/pending_publisher/main.go b/cmd/pending_publisher/main.go index 40dba78d1..a5b23ccf5 100644 --- a/cmd/pending_publisher/main.go +++ b/cmd/pending_publisher/main.go @@ -35,17 +35,18 @@ import ( var build = buildinfo.Revision() func main() { - log.Info(context.Background(), "starting issuer node...", "revision", build) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + log.Info(ctx, "starting pending publisher...", "revision", build) cfg, err := config.Load("") if err != nil { - log.Error(context.Background(), "cannot load config", "err", err) + log.Error(ctx, "cannot load config", "err", err) panic(err) } - // Context with log - ctx, cancel := context.WithCancel(log.NewContext(context.Background(), cfg.Log.Level, cfg.Log.Mode, os.Stdout)) - defer cancel() + log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) if err := cfg.SanitizeAPIUI(ctx); err != nil { log.Error(ctx, "there are errors in the configuration that prevent server to start", "err", err) diff --git a/cmd/platform/main.go b/cmd/platform/main.go index ad43b34a4..b6dd86c2f 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -42,16 +42,18 @@ import ( var build = buildinfo.Revision() func main() { - log.Info(context.Background(), "starting issuer node...", "revision", build) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + log.Info(ctx, "starting issuer node...", "revision", build) cfg, err := config.Load("") if err != nil { - log.Error(context.Background(), "cannot load config", "err", err) + log.Error(ctx, "cannot load config", "err", err) return } - ctx, cancel := context.WithCancel(log.NewContext(context.Background(), cfg.Log.Level, cfg.Log.Mode, os.Stdout)) - defer cancel() + log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) if err := cfg.Sanitize(ctx); err != nil { log.Error(ctx, "there are errors in the configuration that prevent server to start", "err", err) diff --git a/cmd/platform_ui/main.go b/cmd/platform_ui/main.go index 37e7fd08c..cb066577a 100644 --- a/cmd/platform_ui/main.go +++ b/cmd/platform_ui/main.go @@ -49,16 +49,18 @@ import ( var build = buildinfo.Revision() func main() { - log.Info(context.Background(), "starting issuer node...", "revision", build) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + log.Info(ctx, "starting issuer node...", "revision", build) cfg, err := config.Load("") if err != nil { - log.Error(context.Background(), "cannot load config", "err", err) + log.Error(ctx, "cannot load config", "err", err) return } - ctx, cancel := context.WithCancel(log.NewContext(context.Background(), cfg.Log.Level, cfg.Log.Mode, os.Stdout)) - defer cancel() + log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) if err := cfg.SanitizeAPIUI(ctx); err != nil { log.Error(ctx, "there are errors in the configuration that prevent server to start", "err", err) diff --git a/internal/api/main_test.go b/internal/api/main_test.go index 19bf9fb10..9f14a8d4b 100644 --- a/internal/api/main_test.go +++ b/internal/api/main_test.go @@ -38,6 +38,7 @@ const ipfsGatewayURL = "http://localhost:8080" func TestMain(m *testing.M) { ctx := context.Background() + log.Config(log.LevelDebug, log.OutputText, os.Stdout) conn := lookupPostgresURL() if conn == "" { conn = "postgres://postgres:postgres@localhost:5435" diff --git a/internal/api/middleware.go b/internal/api/middleware.go index cef0f6b4f..3acb9ef38 100644 --- a/internal/api/middleware.go +++ b/internal/api/middleware.go @@ -16,9 +16,8 @@ import ( func LogMiddleware(ctx context.Context) StrictMiddlewareFunc { return func(f StrictHandlerFunc, operationID string) StrictHandlerFunc { return func(ctxReq context.Context, w http.ResponseWriter, r *http.Request, args interface{}) (interface{}, error) { - ctx := log.CopyFromContext(ctx, ctxReq) if reqID := middleware.GetReqID(ctxReq); reqID != "" { - ctx = log.With(ctx, "req-id", reqID) + log.With("req-id", reqID) } return f(ctx, w, r, args) } diff --git a/internal/api/server_test.go b/internal/api/server_test.go index 3b3c04798..84b2d1089 100644 --- a/internal/api/server_test.go +++ b/internal/api/server_test.go @@ -7,7 +7,6 @@ import ( "net/http" "net/http/httptest" "net/url" - "os" "strings" "testing" "time" @@ -28,7 +27,6 @@ import ( "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/core/services" "github.com/polygonid/sh-id-platform/internal/db/tests" - "github.com/polygonid/sh-id-platform/internal/log" "github.com/polygonid/sh-id-platform/internal/repositories" "github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status" "github.com/polygonid/sh-id-platform/pkg/pubsub" @@ -356,7 +354,7 @@ func TestServer_CreateClaim(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() diff --git a/internal/api_ui/main_test.go b/internal/api_ui/main_test.go index b4a2dd77e..babe5b422 100644 --- a/internal/api_ui/main_test.go +++ b/internal/api_ui/main_test.go @@ -41,6 +41,7 @@ const ipfsGatewayURL = "http://localhost:8080" func TestMain(m *testing.M) { ctx := context.Background() + log.Config(log.LevelDebug, log.OutputText, os.Stdout) conn := lookupPostgresURL() if conn == "" { conn = "postgres://postgres:postgres@localhost:5435" diff --git a/internal/api_ui/middleware.go b/internal/api_ui/middleware.go index 7359c5d4b..e05c40f18 100644 --- a/internal/api_ui/middleware.go +++ b/internal/api_ui/middleware.go @@ -16,9 +16,8 @@ import ( func LogMiddleware(ctx context.Context) StrictMiddlewareFunc { return func(f StrictHandlerFunc, operationID string) StrictHandlerFunc { return func(ctxReq context.Context, w http.ResponseWriter, r *http.Request, args interface{}) (interface{}, error) { - ctx := log.CopyFromContext(ctx, ctxReq) if reqID := middleware.GetReqID(ctxReq); reqID != "" { - ctx = log.With(ctx, "req-id", reqID) + log.With("req-id", reqID) } return f(ctx, w, r, args) } diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 7000697c2..188699355 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -8,7 +8,6 @@ import ( "net/http" "net/http/httptest" "net/url" - "os" "strconv" "strings" "testing" @@ -32,7 +31,6 @@ import ( "github.com/polygonid/sh-id-platform/internal/core/services" "github.com/polygonid/sh-id-platform/internal/db/tests" "github.com/polygonid/sh-id-platform/internal/health" - "github.com/polygonid/sh-id-platform/internal/log" "github.com/polygonid/sh-id-platform/internal/repositories" "github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status" linkState "github.com/polygonid/sh-id-platform/pkg/link" @@ -796,7 +794,7 @@ func TestServer_DeleteConnection(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -1046,7 +1044,7 @@ func TestServer_RevokeConnectionCredentials(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -1157,7 +1155,7 @@ func TestServer_CreateCredential(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -1437,7 +1435,7 @@ func TestServer_GetCredential(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -1628,7 +1626,7 @@ func TestServer_GetCredentials(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -2097,7 +2095,7 @@ func TestServer_GetCredentialQrCode(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -2240,7 +2238,7 @@ func TestServer_GetConnection(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -2425,7 +2423,7 @@ func TestServer_GetConnections(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -3037,7 +3035,7 @@ func TestServer_RevokeCredential(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -3174,7 +3172,7 @@ func TestServer_CreateLink(t *testing.T) { url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -3400,7 +3398,7 @@ func TestServer_ActivateLink(t *testing.T) { url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -3549,7 +3547,7 @@ func TestServer_GetLink(t *testing.T) { url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -3725,7 +3723,7 @@ func TestServer_GetAllLinks(t *testing.T) { sUrl = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -3947,7 +3945,7 @@ func TestServer_DeleteLink(t *testing.T) { url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() schemaRepository := repositories.NewSchema(*storage) @@ -4062,7 +4060,7 @@ func TestServer_DeleteLinkForDifferentDID(t *testing.T) { url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -4174,7 +4172,7 @@ func TestServer_CreateLinkQRCode(t *testing.T) { url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -4361,7 +4359,7 @@ func TestServer_GetLinkQRCode(t *testing.T) { url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -4546,7 +4544,7 @@ func TestServer_GetStateStatus(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -4650,7 +4648,7 @@ func TestServer_GetStateTransactions(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() @@ -4736,7 +4734,7 @@ func TestServer_GetRevocationStatus(t *testing.T) { network = "mumbai" BJJ = "BJJ" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() diff --git a/internal/core/services/tests/main_test.go b/internal/core/services/tests/main_test.go index d99094a4c..667214014 100644 --- a/internal/core/services/tests/main_test.go +++ b/internal/core/services/tests/main_test.go @@ -33,6 +33,7 @@ const ipfsGateway = "http://localhost:8080" func TestMain(m *testing.M) { ctx := context.Background() + log.Config(log.LevelDebug, log.OutputText, os.Stdout) conn := lookupPostgresURL() if conn == "" { conn = "postgres://postgres:postgres@localhost:5435" diff --git a/internal/core/services/tests/notification_test.go b/internal/core/services/tests/notification_test.go index 3db3717fe..b65523d47 100644 --- a/internal/core/services/tests/notification_test.go +++ b/internal/core/services/tests/notification_test.go @@ -2,7 +2,6 @@ package services_tests import ( "context" - "os" "testing" commonEth "github.com/ethereum/go-ethereum/common" @@ -18,7 +17,6 @@ import ( "github.com/polygonid/sh-id-platform/internal/core/services" "github.com/polygonid/sh-id-platform/internal/db/tests" "github.com/polygonid/sh-id-platform/internal/gateways" - "github.com/polygonid/sh-id-platform/internal/log" "github.com/polygonid/sh-id-platform/internal/repositories" "github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status" "github.com/polygonid/sh-id-platform/pkg/http" @@ -32,7 +30,7 @@ func TestNotification_SendNotification(t *testing.T) { blockchain = "polygon" network = "mumbai" ) - ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) + ctx := context.Background() identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() identityStateRepo := repositories.NewIdentityState() diff --git a/internal/loader/cache.go b/internal/loader/cache.go index b238eeb80..96aa4e40c 100644 --- a/internal/loader/cache.go +++ b/internal/loader/cache.go @@ -24,7 +24,7 @@ type cached struct { // and caches it. // TTL for cached items is forever func (c *cached) Load(ctx context.Context) (schema []byte, extension string, err error) { - ctx = log.With(ctx, "key", c.key(c.url)) + log.With("key", c.key(c.url)) d := schemaData{} if found := c.cache.Get(ctx, c.key(c.url), &d); found { log.Debug(ctx, "schema found in cache") diff --git a/internal/log/log.go b/internal/log/log.go index bfce33e16..9dd1e5d69 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -1,14 +1,12 @@ +// Package log is a wrapper around go >1.21 slog package. package log import ( "context" "io" - - "golang.org/x/exp/slog" + "log/slog" ) -type contextKey struct{} - // Log configuration constants const ( LevelDebug = int(slog.LevelDebug) // debug level @@ -20,8 +18,10 @@ const ( OutputText = 2 // log output will be text format ) -// NewContext returns a context with an injected logger. -func NewContext(ctx context.Context, level, format int, w io.Writer) context.Context { +// Config configures the default logger. +func Config(level, format int, w io.Writer) { + var handler slog.Handler + l := slog.LevelVar{} l.Set(slog.Level(level)) @@ -29,51 +29,35 @@ func NewContext(ctx context.Context, level, format int, w io.Writer) context.Con AddSource: false, Level: &l, } + handler = slog.NewTextHandler(w, &opts) if format == OutputJSON { - return newContext(ctx, slog.New(slog.NewJSONHandler(w, &opts))) + handler = slog.NewJSONHandler(w, &opts) } - return newContext(ctx, slog.New(slog.NewTextHandler(w, &opts))) -} - -// CopyFromContext is a helper function that extracts returns a new context from dest, adding -// the log included in orig. -func CopyFromContext(orig, dest context.Context) context.Context { - return newContext(dest, fromContext(orig)) + slog.SetDefault(slog.New(handler)) } -// With changes the context logger with a new logger that will include the extra attributes +// With changes the default logger to include the extra attributes // from args parameters. -func With(ctx context.Context, args ...any) context.Context { - return newContext(ctx, fromContext(ctx).With(args...)) +func With(args ...any) { + slog.With(args...) } // Debug logs a debug message using context logger func Debug(ctx context.Context, msg string, args ...any) { - fromContext(ctx).Debug(msg, args...) + slog.DebugContext(ctx, msg, args...) } // Info logs an info using context logger func Info(ctx context.Context, msg string, args ...any) { - fromContext(ctx).Info(msg, args...) + slog.InfoContext(ctx, msg, args...) } // Warn logs a warning using context logger func Warn(ctx context.Context, msg string, args ...any) { - fromContext(ctx).Warn(msg, args...) + slog.WarnContext(ctx, msg, args...) } // Error logs an error using context logger func Error(ctx context.Context, msg string, args ...any) { - fromContext(ctx).Error(msg, args...) -} - -func newContext(ctx context.Context, l *slog.Logger) context.Context { - return context.WithValue(ctx, contextKey{}, l) -} - -func fromContext(ctx context.Context) *slog.Logger { - if l, ok := ctx.Value(contextKey{}).(*slog.Logger); ok { - return l - } - return slog.Default() + slog.ErrorContext(ctx, msg, args...) } diff --git a/internal/repositories/tests/main_test.go b/internal/repositories/tests/main_test.go index 1b7003dee..5b281b597 100644 --- a/internal/repositories/tests/main_test.go +++ b/internal/repositories/tests/main_test.go @@ -1,13 +1,14 @@ package tests import ( - "log" + "context" "os" "testing" "github.com/polygonid/sh-id-platform/internal/config" "github.com/polygonid/sh-id-platform/internal/db" "github.com/polygonid/sh-id-platform/internal/db/tests" + "github.com/polygonid/sh-id-platform/internal/log" ) var storage *db.Storage @@ -17,6 +18,8 @@ func TestMain(m *testing.M) { } func testMain(m *testing.M) int { + ctx := context.Background() + log.Config(log.LevelDebug, log.OutputText, os.Stdout) conn := lookupPostgresURL() if conn == "" { conn = "postgres://postgres:postgres@localhost:5435" @@ -30,7 +33,7 @@ func testMain(m *testing.M) int { s, teardown, err := tests.NewTestStorage(&cfg) defer teardown() if err != nil { - log.Println("failed to acquire test database") + log.Info(ctx, "failed to acquire test database") return 1 } storage = s diff --git a/pkg/http/client.go b/pkg/http/client.go index 45dc67ab7..4e52de0eb 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -69,7 +69,7 @@ func addRequestIDToHeader(ctx context.Context, r *http.Request) { // executeRequest contains common logic of request execution func executeRequest(ctx context.Context, c *Client, r *http.Request) ([]byte, error) { - ctx = log.With(ctx, "method", r.Method, "uri", r.RequestURI) + log.With("method", r.Method, "uri", r.RequestURI) resp, err := c.base.Do(r) if err != nil { log.Error(ctx, "http request", "err", err) diff --git a/tools/vault-migrator/main.go b/tools/vault-migrator/main.go index 352a17cb5..84a6f298d 100644 --- a/tools/vault-migrator/main.go +++ b/tools/vault-migrator/main.go @@ -36,8 +36,10 @@ var ( ) func main() { - ctx, cancel := context.WithCancel(log.NewContext(context.Background(), -4, 1, os.Stdout)) + ctx, cancel := context.WithCancel(context.Background()) defer cancel() + + log.Config(log.LevelDebug, log.OutputJSON, os.Stdout) flag.Parse() if fVaultAddr == nil || fVaultToken == nil { log.Error(ctx, "vault-addr and vault-token are required") From 1cf07a3bed1fbe9db022ea3ca93edd89e3f83160 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 29 Dec 2023 18:01:54 +0100 Subject: [PATCH 010/110] chore: Use golang:1.21 as base image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index de0a8345f..47f37f3e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.5 as base +FROM golang:1.21 as base ARG VERSION WORKDIR /service ENV GOBIN /service/bin From c4af78566cbd05d8aac6da699d4907d1c194476f Mon Sep 17 00:00:00 2001 From: javip97 Date: Thu, 4 Jan 2024 12:56:19 +0100 Subject: [PATCH 011/110] chore: avoid fetching credentials with empty mtp proofs --- api/api.yaml | 8 ++++++++ api_ui/api.yaml | 8 ++++++++ internal/api/api.gen.go | 14 ++++++++++++++ internal/api/server.go | 5 +++++ internal/api_ui/api.gen.go | 14 ++++++++++++++ internal/api_ui/server.go | 3 +++ internal/api_ui/server_test.go | 20 ++++++++++++++++---- internal/core/domain/claim.go | 9 +++++++++ internal/core/services/claims.go | 5 +++++ 9 files changed, 82 insertions(+), 4 deletions(-) diff --git a/api/api.yaml b/api/api.yaml index 12b158f12..fc2c50a0d 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -398,6 +398,8 @@ paths: $ref: '#/components/responses/400' '404': $ref: '#/components/responses/404' + '409': + $ref: '#/components/responses/409' '500': $ref: '#/components/responses/500' #agent @@ -933,6 +935,12 @@ components: application/json: schema: $ref: '#/components/schemas/GenericErrorMessage' + '409': + description: 'Conflict' + content: + application/json: + schema: + $ref: '#/components/schemas/GenericErrorMessage' '407': description: 'Proxy Authentication Required' content: diff --git a/api_ui/api.yaml b/api_ui/api.yaml index d7592ba1c..e8872eb7d 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -504,6 +504,8 @@ paths: $ref: '#/components/responses/400' '404': $ref: '#/components/responses/404' + '409': + $ref: '#/components/responses/409' '500': $ref: '#/components/responses/500' @@ -1837,6 +1839,12 @@ components: application/json: schema: $ref: '#/components/schemas/GenericErrorMessage' + '409': + description: 'Conflict' + content: + application/json: + schema: + $ref: '#/components/schemas/GenericErrorMessage' '422': description: 'Unprocessable Content' content: diff --git a/internal/api/api.gen.go b/internal/api/api.gen.go index 20c39336b..45d02f603 100644 --- a/internal/api/api.gen.go +++ b/internal/api/api.gen.go @@ -229,6 +229,9 @@ type N403 = GenericErrorMessage // N404 defines model for 404. type N404 = GenericErrorMessage +// N409 defines model for 409. +type N409 = GenericErrorMessage + // N422 defines model for 422. type N422 = GenericErrorMessage @@ -1140,6 +1143,8 @@ type N403JSONResponse GenericErrorMessage type N404JSONResponse GenericErrorMessage +type N409JSONResponse GenericErrorMessage + type N422JSONResponse GenericErrorMessage type N500JSONResponse GenericErrorMessage @@ -1734,6 +1739,15 @@ func (response GetClaimQrCode404JSONResponse) VisitGetClaimQrCodeResponse(w http return json.NewEncoder(w).Encode(response) } +type GetClaimQrCode409JSONResponse struct{ N409JSONResponse } + +func (response GetClaimQrCode409JSONResponse) VisitGetClaimQrCodeResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(409) + + return json.NewEncoder(w).Encode(response) +} + type GetClaimQrCode500JSONResponse struct{ N500JSONResponse } func (response GetClaimQrCode500JSONResponse) VisitGetClaimQrCodeResponse(w http.ResponseWriter) error { diff --git a/internal/api/server.go b/internal/api/server.go index 6db1aedd7..125cc1cde 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -369,6 +369,11 @@ func (s *Server) GetClaimQrCode(ctx context.Context, request GetClaimQrCodeReque } return GetClaimQrCode500JSONResponse{N500JSONResponse{err.Error()}}, nil } + + if !claim.ValidProof() { + return GetClaimQrCode409JSONResponse{N409JSONResponse{"State must be published before fetching MTP type credential"}}, nil + } + return toGetClaimQrCode200JSONResponse(claim, s.cfg.ServerUrl), nil } diff --git a/internal/api_ui/api.gen.go b/internal/api_ui/api.gen.go index 90269f0a8..f22c0af4b 100644 --- a/internal/api_ui/api.gen.go +++ b/internal/api_ui/api.gen.go @@ -388,6 +388,9 @@ type N401 = GenericErrorMessage // N404 defines model for 404. type N404 = GenericErrorMessage +// N409 defines model for 409. +type N409 = GenericErrorMessage + // N422 defines model for 422. type N422 = GenericErrorMessage @@ -2188,6 +2191,8 @@ type N401JSONResponse GenericErrorMessage type N404JSONResponse GenericErrorMessage +type N409JSONResponse GenericErrorMessage + type N422JSONResponse GenericErrorMessage type N500JSONResponse GenericErrorMessage @@ -3204,6 +3209,15 @@ func (response GetCredentialQrCode404JSONResponse) VisitGetCredentialQrCodeRespo return json.NewEncoder(w).Encode(response) } +type GetCredentialQrCode409JSONResponse struct{ N409JSONResponse } + +func (response GetCredentialQrCode409JSONResponse) VisitGetCredentialQrCodeResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(409) + + return json.NewEncoder(w).Encode(response) +} + type GetCredentialQrCode500JSONResponse struct{ N500JSONResponse } func (response GetCredentialQrCode500JSONResponse) VisitGetCredentialQrCodeResponse(w http.ResponseWriter) error { diff --git a/internal/api_ui/server.go b/internal/api_ui/server.go index 044fcc87a..a21222558 100644 --- a/internal/api_ui/server.go +++ b/internal/api_ui/server.go @@ -617,6 +617,9 @@ func (s *Server) GetCredentialQrCode(ctx context.Context, req GetCredentialQrCod if errors.Is(err, services.ErrClaimNotFound) { return GetCredentialQrCode400JSONResponse{N400JSONResponse{"Credential not found"}}, nil } + if errors.Is(err, services.ErrEmptyMTPProof) { + return GetCredentialQrCode409JSONResponse{N409JSONResponse{"State must be published before fetching MTP type credentials"}}, nil + } return GetCredentialQrCode500JSONResponse{N500JSONResponse{err.Error()}}, nil } qrContent := resp.QrCodeURL diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 7000697c2..aa9e1c60a 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -2128,7 +2128,9 @@ func TestServer_GetCredentialQrCode(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "index" schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" - createdClaim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + createdSIGClaim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + require.NoError(t, err) + createdMTPClaim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(false), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) require.NoError(t, err) type expected struct { @@ -2153,10 +2155,20 @@ func TestServer_GetCredentialQrCode(t *testing.T) { httpCode: http.StatusBadRequest, }, }, + { + name: "no mtp proof", + request: GetCredentialQrCodeRequestObject{ + Id: createdMTPClaim.ID, + }, + expected: expected{ + message: common.ToPointer("State must be published before fetching MTP type credentials"), + httpCode: http.StatusConflict, + }, + }, { name: "happy path", request: GetCredentialQrCodeRequestObject{ - Id: createdClaim.ID, + Id: createdSIGClaim.ID, }, expected: expected{ httpCode: http.StatusOK, @@ -2166,7 +2178,7 @@ func TestServer_GetCredentialQrCode(t *testing.T) { { name: "happy path with qr code of type link", request: GetCredentialQrCodeRequestObject{ - Id: createdClaim.ID, + Id: createdSIGClaim.ID, Params: GetCredentialQrCodeParams{ Type: common.ToPointer(GetCredentialQrCodeParamsTypeLink), }, @@ -2179,7 +2191,7 @@ func TestServer_GetCredentialQrCode(t *testing.T) { { name: "happy path with qr code of type raw", request: GetCredentialQrCodeRequestObject{ - Id: createdClaim.ID, + Id: createdSIGClaim.ID, Params: GetCredentialQrCodeParams{ Type: common.ToPointer(GetCredentialQrCodeParamsTypeRaw), }, diff --git a/internal/core/domain/claim.go b/internal/core/domain/claim.go index 46388b483..dae22da35 100644 --- a/internal/core/domain/claim.go +++ b/internal/core/domain/claim.go @@ -125,6 +125,15 @@ func (c *CoreClaim) Get() *core.Claim { return (*core.Claim)(c) } +// ValidProof returns true if the claim has a valid proof +func (c *Claim) ValidProof() bool { + if !c.MtProof || c.SignatureProof.Status != pgtype.Null { // this second condition is for credentials that has both types of proofs + return true + } + + return c.MTPProof.Status != pgtype.Null +} + // BuildTreeState returns circuits.TreeState structure func BuildTreeState(state, claimsTreeRoot, revocationTreeRoot, rootOfRoots *string) (circuits.TreeState, error) { return circuits.TreeState{ diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 1511d1ad7..aab786971 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -49,6 +49,7 @@ var ( ErrInvalidCredentialSubject = errors.New("credential subject does not match the provided schema") // ErrInvalidCredentialSubject means the credentialSubject does not match the schema provided ErrUnsupportedRefreshServiceType = errors.New("unsupported refresh service type") // ErrUnsupportedRefreshServiceType means the refresh service type is not supported ErrRefreshServiceLacksExpirationTime = errors.New("credential request with refresh service lacks expiration time") // ErrRefreshServiceLacksExpirationTime means the credential request includes a refresh service, but the expiration time is not set + ErrEmptyMTPProof = errors.New("mtp credentials must have a mtp proof to be fetched") // ErrEmptyMTPProof means that a credential of MTP type can not be fetched if it does not contain the proof ) type claim struct { @@ -321,6 +322,10 @@ func (c *claim) GetCredentialQrCode(ctx context.Context, issID *w3c.DID, id uuid if err != nil { return nil, err } + + if !claim.ValidProof() { + return nil, ErrEmptyMTPProof + } credID := uuid.New() qrCode := protocol.CredentialsOfferMessage{ Body: protocol.CredentialsOfferMessageBody{ From 4d3f50ea3d2a2bd65e737a5ecf35b78aa24ac2c2 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Thu, 4 Jan 2024 11:13:17 -0300 Subject: [PATCH 012/110] fix: prevent publishing states for bjj sig credentials --- internal/api_ui/server.go | 5 +++++ internal/core/services/identity.go | 6 ++++++ internal/core/services/tests/identity_test.go | 2 +- internal/repositories/claims.go | 4 ++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/internal/api_ui/server.go b/internal/api_ui/server.go index e7c857b68..817066a1d 100644 --- a/internal/api_ui/server.go +++ b/internal/api_ui/server.go @@ -401,6 +401,11 @@ func (s *Server) PublishState(ctx context.Context, request PublishStateRequestOb publishedState, err := s.publisherGateway.PublishState(ctx, &s.cfg.APIUI.IssuerDID) if err != nil { log.Error(ctx, "error publishing the state", "err", err) + + if errors.Is(err, services.ErrNoClaimsFoundToProcess) { + return PublishState400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } + if errors.Is(err, gateways.ErrStateIsBeingProcessed) || errors.Is(err, gateways.ErrNoStatesToProcess) { return PublishState400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil } diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index 425ddbdeb..cfb4075e4 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -55,6 +55,8 @@ var ( ErrWrongDIDMetada = errors.New("wrong DID Metadata") // ErrAssigningMTPProof - represents an error in the identity metadata ErrAssigningMTPProof = errors.New("error assigning the MTP Proof from Auth Claim. If this identity has keyType=ETH you must to publish the state first") + // ErrNoClaimsFoundToProcess - means that there are no claims to process + ErrNoClaimsFoundToProcess = errors.New("no MTP claims found to process") ) type identity struct { @@ -331,6 +333,10 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi return fmt.Errorf("error getting the states: %w", err) } + if len(lc) == 0 { + return ErrNoClaimsFoundToProcess + } + for i := range lc { err = iTrees.AddClaim(ctx, &lc[i]) if err != nil { diff --git a/internal/core/services/tests/identity_test.go b/internal/core/services/tests/identity_test.go index 90c91648d..f26a2b6b9 100644 --- a/internal/core/services/tests/identity_test.go +++ b/internal/core/services/tests/identity_test.go @@ -82,7 +82,7 @@ func Test_identity_UpdateState(t *testing.T) { { name: "should get a new state for identity without claim", did: did2, - shouldReturnErr: false, + shouldReturnErr: true, }, { name: "should return an error", diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index 4628944b6..ded757d45 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -512,7 +512,7 @@ func (c *claims) GetAllByState(ctx context.Context, conn db.Querier, did *w3c.DI credential_status, core_claim FROM claims - WHERE issuer = $1 AND identity_state IS NULL AND identifier = issuer + WHERE issuer = $1 AND identity_state IS NULL AND identifier = issuer AND mtp = true `, did.String()) } else { rows, err = conn.Query(ctx, ` @@ -537,7 +537,7 @@ func (c *claims) GetAllByState(ctx context.Context, conn db.Querier, did *w3c.DI core_claim FROM claims LEFT OUTER JOIN identity_states ON claims.identity_state = identity_states.state - WHERE issuer = $1 AND identity_state = $2 AND claims.identifier = issuer + WHERE issuer = $1 AND identity_state = $2 AND claims.identifier = issuer AND mtp = true `, did.String(), state.Hex()) } From 0691f307c2267d22447c0f3aa6ca0d9765d32bbc Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 10 Jan 2024 18:17:12 +0100 Subject: [PATCH 013/110] feat: QrCode type switcher in credentials --- ui/src/adapters/api/credentials.ts | 32 +++++++--- .../credentials/CredentialIssuedQR.tsx | 28 ++++---- .../components/credentials/CredentialQR.tsx | 64 ++++++++++++------- 3 files changed, 79 insertions(+), 45 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 786565b95..e7f976437 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -437,7 +437,7 @@ const issuedQRCodeParser = getStrictParser()( }) ); -export async function getIssuedQRCode({ +export async function getIssuedQRCodes({ credentialID, env, signal, @@ -445,15 +445,29 @@ export async function getIssuedQRCode({ credentialID: string; env: Env; signal: AbortSignal; -}): Promise> { +}): Promise> { try { - const response = await axios({ - baseURL: env.api.url, - method: "GET", - signal, - url: `${API_VERSION}/credentials/${credentialID}/qrcode`, - }); - return buildSuccessResponse(issuedQRCodeParser.parse(response.data)); + const [qrLinkResponse, qrRawResponse] = await Promise.all([ + axios({ + baseURL: env.api.url, + method: "GET", + params: { type: "link" }, + signal, + url: `${API_VERSION}/credentials/${credentialID}/qrcode`, + }), + axios({ + baseURL: env.api.url, + method: "GET", + params: { type: "raw" }, + signal, + url: `${API_VERSION}/credentials/${credentialID}/qrcode`, + }), + ]); + + return buildSuccessResponse([ + issuedQRCodeParser.parse(qrLinkResponse.data), + issuedQRCodeParser.parse(qrRawResponse.data), + ]); } catch (error) { return buildErrorResponse(error); } diff --git a/ui/src/components/credentials/CredentialIssuedQR.tsx b/ui/src/components/credentials/CredentialIssuedQR.tsx index e929a8a98..c54bf944a 100644 --- a/ui/src/components/credentials/CredentialIssuedQR.tsx +++ b/ui/src/components/credentials/CredentialIssuedQR.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from "react"; import { useParams } from "react-router-dom"; -import { getIssuedQRCode } from "src/adapters/api/credentials"; +import { getIssuedQRCodes } from "src/adapters/api/credentials"; import { CredentialQR } from "src/components/credentials/CredentialQR"; import { ErrorResult } from "src/components/shared/ErrorResult"; import { LoadingResult } from "src/components/shared/LoadingResult"; @@ -13,7 +13,9 @@ import { isAbortedError, makeRequestAbortable } from "src/utils/browser"; export function CredentialIssuedQR() { const env = useEnvContext(); - const [issuedQRCode, setIssuedQRCode] = useState>({ + const [issuedQRCodes, setIssuedQRCodes] = useState< + AsyncTask<[IssuedQRCode, IssuedQRCode], AppError> + >({ status: "pending", }); @@ -22,15 +24,15 @@ export function CredentialIssuedQR() { const createCredentialQR = useCallback( async (signal: AbortSignal) => { if (credentialID) { - setIssuedQRCode({ status: "loading" }); + setIssuedQRCodes({ status: "loading" }); - const response = await getIssuedQRCode({ credentialID, env, signal }); + const response = await getIssuedQRCodes({ credentialID, env, signal }); if (response.success) { - setIssuedQRCode({ data: response.data, status: "successful" }); + setIssuedQRCodes({data: response.data, status: "successful"}); } else { if (!isAbortedError(response.error)) { - setIssuedQRCode({ error: response.error, status: "failed" }); + setIssuedQRCodes({ error: response.error, status: "failed" }); } } } @@ -46,27 +48,29 @@ export function CredentialIssuedQR() { const onStartAgain = () => { makeRequestAbortable(createCredentialQR); - setIssuedQRCode({ status: "pending" }); + setIssuedQRCodes({ status: "pending" }); }; - if (hasAsyncTaskFailed(issuedQRCode)) { + if (hasAsyncTaskFailed(issuedQRCodes)) { return ( ); } - if (!isAsyncTaskDataAvailable(issuedQRCode)) { + if (!isAsyncTaskDataAvailable(issuedQRCodes)) { return ; } + const [issuedQRCodeLink, issuedQRCodeRaw] = issuedQRCodes.data; return ( ); diff --git a/ui/src/components/credentials/CredentialQR.tsx b/ui/src/components/credentials/CredentialQR.tsx index 003740740..b6feb83ab 100644 --- a/ui/src/components/credentials/CredentialQR.tsx +++ b/ui/src/components/credentials/CredentialQR.tsx @@ -1,4 +1,4 @@ -import { Avatar, Card, Col, Grid, Image, Row, Space, Typography } from "antd"; +import { Avatar, Card, Col, Grid, Image, Row, Space, Tabs, TabsProps, Typography } from "antd"; import { QRCodeSVG } from "qrcode.react"; import { ReactNode } from "react"; @@ -6,11 +6,13 @@ import { useEnvContext } from "src/contexts/Env"; import { WALLET_APP_STORE_URL, WALLET_PLAY_STORE_URL } from "src/utils/constants"; export function CredentialQR({ - qrCode, + qrCodeLink, + qrCodeRaw, schemaType, subTitle, }: { - qrCode: string; + qrCodeLink: string; + qrCodeRaw: string; schemaType: string; subTitle: ReactNode; }) { @@ -18,6 +20,35 @@ export function CredentialQR({ const { lg } = Grid.useBreakpoint(); + const qrCodeTabs: TabsProps["items"] = [ + { + children: ( + + ), + key: "1", + label: "Raw JSON", + }, + { + children: ( + + ), + key: "2", + label: "Link", + }, + ]; + return ( @@ -42,28 +73,13 @@ export function CredentialQR({ - + - - - - - - {schemaType && ( Date: Thu, 11 Jan 2024 13:31:48 +0200 Subject: [PATCH 014/110] support display service --- .golangci.yml | 2 +- api/api.yaml | 20 ++++++ api_ui/api.yaml | 26 ++++++- go.mod | 4 +- go.sum | 16 +++-- internal/api/api.gen.go | 16 +++++ internal/api/server.go | 31 +++++++- internal/api/server_test.go | 2 +- internal/api_ui/api.gen.go | 18 +++++ internal/api_ui/responses.go | 9 +++ internal/api_ui/server.go | 24 ++++++- internal/api_ui/server_test.go | 70 +++++++++++-------- internal/core/domain/link.go | 2 + internal/core/ports/claims_service.go | 4 +- internal/core/ports/link_service.go | 2 +- internal/core/services/claims.go | 42 ++++++++++- internal/core/services/link.go | 44 +++++++++++- internal/core/services/tests/identity_test.go | 2 +- internal/core/services/tests/link_test.go | 6 +- ...24427_add_display_method_to_link_table.sql | 11 +++ internal/repositories/link_repository.go | 10 ++- internal/repositories/tests/claims_test.go | 2 +- internal/repositories/tests/link_test.go | 29 +++++--- 23 files changed, 325 insertions(+), 67 deletions(-) create mode 100644 internal/db/schema/migrations/20240111024427_add_display_method_to_link_table.sql diff --git a/.golangci.yml b/.golangci.yml index 9a43c54c1..889275913 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -71,7 +71,7 @@ linters-settings: - name: argument-limit severity: warning disabled: false - arguments: [ 15 ] + arguments: [ 16 ] - name: exported severity: warning disabled: false diff --git a/api/api.yaml b/api/api.yaml index 12b158f12..781fb58e6 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -627,6 +627,22 @@ components: enum: - "Iden3RefreshService2023" + # display method + DisplayMethod: + type: object + required: + - id + - type + properties: + id: + type: string + x-omitempty: false + type: + type: string + x-omitempty: false + enum: + - "Iden3BasicDisplayMethodV1" + #claims CreateClaimRequest: type: object @@ -659,6 +675,8 @@ components: type: string refreshService: $ref: '#/components/schemas/RefreshService' + displayMethod: + $ref: '#/components/schemas/DisplayMethod' example: credentialSchema: "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" type: "KYCAgeCredential" @@ -724,6 +742,8 @@ components: x-omitempty: false proof: type: null + displayMethod: + $ref: '#/components/schemas/DisplayMethod' refreshService: $ref: '#/components/schemas/RefreshService' diff --git a/api_ui/api.yaml b/api_ui/api.yaml index 6d7acaf36..8b8833616 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -1302,6 +1302,8 @@ components: example: "KYC Age Credential" refreshService: $ref: '#/components/schemas/RefreshService' + displayMethod: + $ref: '#/components/schemas/DisplayMethod' Link: @@ -1364,6 +1366,8 @@ components: example: [ "BJJSignature2021" ] refreshService: $ref: '#/components/schemas/RefreshService' + displayMethod: + $ref: '#/components/schemas/DisplayMethod' LinkSimple: type: object @@ -1515,7 +1519,7 @@ components: items: $ref: '#/components/schemas/Credential' - # refresh service + # refresh service RefreshService: type: object required: @@ -1531,6 +1535,22 @@ components: enum: - "Iden3RefreshService2023" + # display method + DisplayMethod: + type: object + required: + - id + - type + properties: + id: + type: string + x-omitempty: false + type: + type: string + x-omitempty: false + enum: + - "Iden3BasicDisplayMethodV1" + CreateCredentialRequest: type: object required: @@ -1565,6 +1585,8 @@ components: example: true refreshService: $ref: '#/components/schemas/RefreshService' + displayMethod: + $ref: '#/components/schemas/DisplayMethod' Schema: type: object required: @@ -1676,6 +1698,8 @@ components: $ref: '#/components/schemas/CredentialSubject' refreshService: $ref: '#/components/schemas/RefreshService' + displayMethod: + $ref: '#/components/schemas/DisplayMethod' CredentialSubject: type: object diff --git a/go.mod b/go.mod index fa325a8e0..fb8f0421f 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f github.com/iden3/go-circuits/v2 v2.0.0 github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 - github.com/iden3/go-iden3-core/v2 v2.0.0 + github.com/iden3/go-iden3-core/v2 v2.0.3 github.com/iden3/go-iden3-crypto v0.0.15 github.com/iden3/go-jwz/v2 v2.0.0 github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 @@ -30,7 +30,7 @@ require ( github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 - github.com/iden3/go-schema-processor/v2 v2.1.0 + github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240111003118-4f6fe4efdb18 github.com/iden3/iden3comm/v2 v2.0.0 github.com/iden3/merkletree-proof v0.0.4 github.com/ipfs/go-ipfs-api v0.7.0 diff --git a/go.sum b/go.sum index 33d42f6ca..c424a7a63 100644 --- a/go.sum +++ b/go.sum @@ -486,8 +486,8 @@ github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 h1:r5vjH+MyPFzaJ7U62SO5Gz9N9O0RZ github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2/go.mod h1:bYr47aev7sh23RL7Ru+TQQSlYDS94+wO8P8SDrwdifc= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= -github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA= -github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= +github.com/iden3/go-iden3-core/v2 v2.0.3 h1:ce9Jbw10zDsinWXFc05SiK2Hof/wu4zV4/ai5gQy29k= +github.com/iden3/go-iden3-core/v2 v2.0.3/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= github.com/iden3/go-jwz/v2 v2.0.0 h1:VsU2PrmcchPMx/V0IhamMZRNjiQYZoyJopO8K8uSZOY= @@ -508,8 +508,16 @@ github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e/go.mod h1:UEBifEzw62T6VzIHJeHuUgeLg2U/J9ttf7hOwQEqnYk= github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFLPTEqnOIvlM= github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= -github.com/iden3/go-schema-processor/v2 v2.1.0 h1:8/fA7IVkyVmpbJij9Ar0X2zWPQJMlCaaPP4hfTZqbqU= -github.com/iden3/go-schema-processor/v2 v2.1.0/go.mod h1:EogHwnFnxQKOGRVme6upCcisoAQeEIl+HuRAGa7w3+w= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240108225035-a703fa427849 h1:ju+Bu4ZoHpZIfiYl0WO4w1tsTcTIsSYUv5O5WyneIb0= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240108225035-a703fa427849/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240108231533-1f3d018d072a h1:DW1NVFZWEXdaVE9kRV6Bb+CW9zOVWCuStf+gS1pAO0o= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240108231533-1f3d018d072a/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240108233115-5aa136f29cf0 h1:V+HWFaulgmuno4vVQtUceOOJSKpoldhMMFpmOJkqxUM= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240108233115-5aa136f29cf0/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240109232752-0fb9c04b0407 h1:TPQhixnNpqMNpi6Wc9llpfSUgAzx6NOpb/7XjC1G4ek= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240109232752-0fb9c04b0407/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240111003118-4f6fe4efdb18 h1:6ojrFj6RTLgYOC+PPBdlCbK73aipWPNHhBRMlEIKW2U= +github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240111003118-4f6fe4efdb18/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= github.com/iden3/iden3comm/v2 v2.0.0 h1:cFDfF6aJ589ENg5zlTBEPK6Qqv4I11C/gliAWZORpyY= github.com/iden3/iden3comm/v2 v2.0.0/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= diff --git a/internal/api/api.gen.go b/internal/api/api.gen.go index 20c39336b..9a723d070 100644 --- a/internal/api/api.gen.go +++ b/internal/api/api.gen.go @@ -27,6 +27,11 @@ const ( ETH CreateIdentityRequestDidMetadataType = "ETH" ) +// Defines values for DisplayMethodType. +const ( + Iden3BasicDisplayMethodV1 DisplayMethodType = "Iden3BasicDisplayMethodV1" +) + // Defines values for RefreshServiceType. const ( Iden3RefreshService2023 RefreshServiceType = "Iden3RefreshService2023" @@ -50,6 +55,7 @@ type Config = []KeyValue type CreateClaimRequest struct { CredentialSchema string `json:"credentialSchema"` CredentialSubject map[string]interface{} `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` Expiration *int64 `json:"expiration,omitempty"` MerklizedRootPosition *string `json:"merklizedRootPosition,omitempty"` RefreshService *RefreshService `json:"refreshService,omitempty"` @@ -90,6 +96,15 @@ type CredentialSchema struct { Type string `json:"type"` } +// DisplayMethod defines model for DisplayMethod. +type DisplayMethod struct { + Id string `json:"id"` + Type DisplayMethodType `json:"type"` +} + +// DisplayMethodType defines model for DisplayMethod.Type. +type DisplayMethodType string + // GenericErrorMessage defines model for GenericErrorMessage. type GenericErrorMessage struct { Message string `json:"message"` @@ -118,6 +133,7 @@ type GetClaimResponse struct { CredentialSchema CredentialSchema `json:"credentialSchema"` CredentialStatus interface{} `json:"credentialStatus"` CredentialSubject map[string]interface{} `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` ExpirationDate *TimeUTC `json:"expirationDate"` Id string `json:"id"` IssuanceDate *TimeUTC `json:"issuanceDate"` diff --git a/internal/api/server.go b/internal/api/server.go index 6db1aedd7..37d7c4fdd 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -160,7 +160,8 @@ func (s *Server) CreateClaim(ctx context.Context, request CreateClaimRequestObje expiration = common.ToPointer(time.Unix(*request.Body.Expiration, 0)) } - req := ports.NewCreateClaimRequest(did, request.Body.CredentialSchema, request.Body.CredentialSubject, expiration, request.Body.Type, request.Body.Version, request.Body.SubjectPosition, request.Body.MerklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.CredentialStatusType(s.cfg.CredentialStatus.CredentialStatusType), toVerifiableRefreshService(request.Body.RefreshService), request.Body.RevNonce) + req := ports.NewCreateClaimRequest(did, request.Body.CredentialSchema, request.Body.CredentialSubject, expiration, request.Body.Type, request.Body.Version, request.Body.SubjectPosition, request.Body.MerklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.CredentialStatusType(s.cfg.CredentialStatus.CredentialStatusType), toVerifiableRefreshService(request.Body.RefreshService), request.Body.RevNonce, + toVerifiableDisplayMethod(request.Body.DisplayMethod)) resp, err := s.claimService.Save(ctx, req) if err != nil { @@ -194,6 +195,15 @@ func (s *Server) CreateClaim(ctx context.Context, request CreateClaimRequestObje if errors.Is(err, services.ErrRefreshServiceLacksExpirationTime) { return CreateClaim400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil } + if errors.Is(err, services.ErrRefreshServiceLacksURL) { + return CreateClaim400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } + if errors.Is(err, services.ErrDisplayMethodLacksURL) { + return CreateClaim400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } + if errors.Is(err, services.ErrUnsupportedDisplayMethodType) { + return CreateClaim400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } return CreateClaim500JSONResponse{N500JSONResponse{Message: err.Error()}}, nil } return CreateClaim201JSONResponse{Id: resp.ID.String()}, nil @@ -563,6 +573,16 @@ func toVerifiableRefreshService(s *RefreshService) *verifiable.RefreshService { } } +func toVerifiableDisplayMethod(s *DisplayMethod) *verifiable.DisplayMethod { + if s == nil { + return nil + } + return &verifiable.DisplayMethod{ + ID: s.Id, + Type: verifiable.DisplayMethodType(s.Type), + } +} + func toGetClaims200Response(claims []*verifiable.W3CCredential) GetClaims200JSONResponse { response := make(GetClaims200JSONResponse, len(claims)) for i := range claims { @@ -589,6 +609,14 @@ func toGetClaim200Response(claim *verifiable.W3CCredential) GetClaimResponse { } } + var displayMethod *DisplayMethod + if claim.DisplayMethod != nil { + displayMethod = &DisplayMethod{ + Id: claim.DisplayMethod.ID, + Type: DisplayMethodType(claim.DisplayMethod.Type), + } + } + return GetClaimResponse{ Context: claim.Context, CredentialSchema: CredentialSchema{ @@ -604,6 +632,7 @@ func toGetClaim200Response(claim *verifiable.W3CCredential) GetClaimResponse { Proof: claim.Proof, Type: claim.Type, RefreshService: refreshService, + DisplayMethod: displayMethod, } } diff --git a/internal/api/server_test.go b/internal/api/server_test.go index 3b3c04798..ff46a09d9 100644 --- a/internal/api/server_test.go +++ b/internal/api/server_test.go @@ -1301,7 +1301,7 @@ func TestServer_GetRevocationStatus(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "value" - claim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + claim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) assert.NoError(t, err) type expected struct { diff --git a/internal/api_ui/api.gen.go b/internal/api_ui/api.gen.go index cff370cce..73a449936 100644 --- a/internal/api_ui/api.gen.go +++ b/internal/api_ui/api.gen.go @@ -23,6 +23,11 @@ const ( BasicAuthScopes = "basicAuth.Scopes" ) +// Defines values for DisplayMethodType. +const ( + Iden3BasicDisplayMethodV1 DisplayMethodType = "Iden3BasicDisplayMethodV1" +) + // Defines values for LinkStatus. const ( LinkStatusActive LinkStatus = "active" @@ -129,6 +134,7 @@ type ConnectionsPaginated struct { type CreateCredentialRequest struct { CredentialSchema string `json:"credentialSchema"` CredentialSubject map[string]interface{} `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` Expiration *time.Time `json:"expiration,omitempty"` MtProof *bool `json:"mtProof,omitempty"` RefreshService *RefreshService `json:"refreshService,omitempty"` @@ -140,6 +146,7 @@ type CreateCredentialRequest struct { type CreateLinkRequest struct { CredentialExpiration *openapi_types.Date `json:"credentialExpiration,omitempty"` CredentialSubject CredentialSubject `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` Expiration *time.Time `json:"expiration,omitempty"` LimitedClaims *int `json:"limitedClaims"` MtProof bool `json:"mtProof"` @@ -152,6 +159,7 @@ type CreateLinkRequest struct { type Credential struct { CreatedAt TimeUTC `json:"createdAt"` CredentialSubject map[string]interface{} `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` Expired bool `json:"expired"` ExpiresAt *TimeUTC `json:"expiresAt"` Id uuid.UUID `json:"id"` @@ -183,6 +191,15 @@ type CredentialsPaginated struct { Meta PaginatedMetadata `json:"meta"` } +// DisplayMethod defines model for DisplayMethod. +type DisplayMethod struct { + Id string `json:"id"` + Type DisplayMethodType `json:"type"` +} + +// DisplayMethodType defines model for DisplayMethod.Type. +type DisplayMethodType string + // GenericErrorMessage defines model for GenericErrorMessage. type GenericErrorMessage struct { Message string `json:"message"` @@ -247,6 +264,7 @@ type Link struct { CreatedAt TimeUTC `json:"createdAt"` CredentialExpiration *TimeUTC `json:"credentialExpiration"` CredentialSubject CredentialSubject `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` Expiration *TimeUTC `json:"expiration"` Id uuid.UUID `json:"id"` IssuedClaims int `json:"issuedClaims"` diff --git a/internal/api_ui/responses.go b/internal/api_ui/responses.go index bbe2f8a1e..1d8d18cb1 100644 --- a/internal/api_ui/responses.go +++ b/internal/api_ui/responses.go @@ -285,6 +285,14 @@ func getLinkResponse(link domain.Link) Link { } } + var displayMethod *DisplayMethod + if link.DisplayMethod != nil { + displayMethod = &DisplayMethod{ + Id: link.DisplayMethod.ID, + Type: DisplayMethodType(link.DisplayMethod.Type), + } + } + return Link{ Id: link.ID, Active: link.Active, @@ -300,6 +308,7 @@ func getLinkResponse(link domain.Link) Link { Expiration: validUntil, CredentialExpiration: credentialExpiration, RefreshService: refreshService, + DisplayMethod: displayMethod, } } diff --git a/internal/api_ui/server.go b/internal/api_ui/server.go index 335096fec..f4950771f 100644 --- a/internal/api_ui/server.go +++ b/internal/api_ui/server.go @@ -344,7 +344,8 @@ func (s *Server) CreateCredential(ctx context.Context, request CreateCredentialR if request.Body.SignatureProof == nil && request.Body.MtProof == nil { return CreateCredential400JSONResponse{N400JSONResponse{Message: "you must to provide at least one proof type"}}, nil } - req := ports.NewCreateClaimRequest(&s.cfg.APIUI.IssuerDID, request.Body.CredentialSchema, request.Body.CredentialSubject, request.Body.Expiration, request.Body.Type, nil, nil, nil, request.Body.SignatureProof, request.Body.MtProof, nil, true, verifiable.CredentialStatusType(s.cfg.CredentialStatus.CredentialStatusType), toVerifiableRefreshService(request.Body.RefreshService), nil) + req := ports.NewCreateClaimRequest(&s.cfg.APIUI.IssuerDID, request.Body.CredentialSchema, request.Body.CredentialSubject, request.Body.Expiration, request.Body.Type, nil, nil, nil, request.Body.SignatureProof, request.Body.MtProof, nil, true, verifiable.CredentialStatusType(s.cfg.CredentialStatus.CredentialStatusType), toVerifiableRefreshService(request.Body.RefreshService), nil, + toDisplayMethodService(request.Body.DisplayMethod)) resp, err := s.claimService.Save(ctx, req) if err != nil { if errors.Is(err, services.ErrJSONLdContext) { @@ -374,6 +375,15 @@ func (s *Server) CreateCredential(ctx context.Context, request CreateCredentialR if errors.Is(err, services.ErrRefreshServiceLacksExpirationTime) { return CreateCredential400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil } + if errors.Is(err, services.ErrRefreshServiceLacksURL) { + return CreateCredential400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } + if errors.Is(err, services.ErrDisplayMethodLacksURL) { + return CreateCredential400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } + if errors.Is(err, services.ErrUnsupportedDisplayMethodType) { + return CreateCredential400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } return CreateCredential500JSONResponse{N500JSONResponse{Message: err.Error()}}, nil } return CreateCredential201JSONResponse{Id: resp.ID.String()}, nil @@ -509,7 +519,7 @@ func (s *Server) CreateLink(ctx context.Context, request CreateLinkRequestObject expirationDate = &request.Body.CredentialExpiration.Time } - createdLink, err := s.linkService.Save(ctx, s.cfg.APIUI.IssuerDID, request.Body.LimitedClaims, request.Body.Expiration, request.Body.SchemaID, expirationDate, request.Body.SignatureProof, request.Body.MtProof, credSubject, toVerifiableRefreshService(request.Body.RefreshService)) + createdLink, err := s.linkService.Save(ctx, s.cfg.APIUI.IssuerDID, request.Body.LimitedClaims, request.Body.Expiration, request.Body.SchemaID, expirationDate, request.Body.SignatureProof, request.Body.MtProof, credSubject, toVerifiableRefreshService(request.Body.RefreshService), toDisplayMethodService(request.Body.DisplayMethod)) if err != nil { log.Error(ctx, "error saving the link", "err", err.Error()) if errors.Is(err, services.ErrLoadingSchema) { @@ -870,3 +880,13 @@ func toVerifiableRefreshService(s *RefreshService) *verifiable.RefreshService { Type: verifiable.RefreshServiceType(s.Type), } } + +func toDisplayMethodService(s *DisplayMethod) *verifiable.DisplayMethod { + if s == nil { + return nil + } + return &verifiable.DisplayMethod{ + ID: s.Id, + Type: verifiable.DisplayMethodType(s.Type), + } +} diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 9b197605b..0e376c7e1 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -1466,13 +1466,13 @@ func TestServer_GetCredential(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "index" schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" - createdClaim1, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + createdClaim1, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) - createdClaim2, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + createdClaim2, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) - createdClaim3, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(false), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + createdClaim3, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(false), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) handler := getHandler(ctx, server) @@ -1666,19 +1666,19 @@ func TestServer_GetCredentials(t *testing.T) { _, err = schemaService.ImportSchema(ctx, *did, iReq) require.NoError(t, err) // Never expires - _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) // Expires in future - _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, &future, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, &future, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) // Expired - claim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, &past, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + claim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, &past, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) // non expired, but revoked - revoked, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, &future, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(false), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + revoked, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, &future, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(false), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) id, err := w3c.ParseDID(*revoked.Identifier) @@ -2128,7 +2128,7 @@ func TestServer_GetCredentialQrCode(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "index" schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" - createdClaim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + createdClaim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) type expected struct { @@ -2475,9 +2475,9 @@ func TestServer_GetConnections(t *testing.T) { } merklizedRootPosition := "index" - _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, nil, schemaType, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject, nil, schemaType, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) - _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject2, nil, schemaType, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schemaURL, credentialSubject2, nil, schemaType, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) usrDID, err := w3c.ParseDID("did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ") @@ -3506,7 +3506,7 @@ func TestServer_ActivateLink(t *testing.T) { server := NewServer(&cfg, NewIdentityMock(), claimsService, NewSchemaMock(), connectionsService, linkService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) tomorrow := time.Now().Add(24 * time.Hour) - link, err := linkService.Save(ctx, *did, common.ToPointer(10), &tomorrow, importedSchema.ID, nil, true, true, CredentialSubject{"birthday": 19790911, "documentType": 12}, nil) + link, err := linkService.Save(ctx, *did, common.ToPointer(10), &tomorrow, importedSchema.ID, nil, true, true, CredentialSubject{"birthday": 19790911, "documentType": 12}, nil, nil) require.NoError(t, err) handler := getHandler(ctx, server) @@ -3657,11 +3657,11 @@ func TestServer_GetLink(t *testing.T) { tomorrow := time.Now().Add(24 * time.Hour) yesterday := time.Now().Add(-24 * time.Hour) - link, err := linkService.Save(ctx, *did, common.ToPointer(10), &tomorrow, importedSchema.ID, common.ToPointer(tomorrow), true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link, err := linkService.Save(ctx, *did, common.ToPointer(10), &tomorrow, importedSchema.ID, common.ToPointer(tomorrow), true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) require.NoError(t, err) hash, _ := link.Schema.Hash.MarshalText() - linkExpired, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, common.ToPointer(tomorrow), true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + linkExpired, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, common.ToPointer(tomorrow), true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) require.NoError(t, err) handler := getHandler(ctx, server) @@ -3833,25 +3833,37 @@ func TestServer_GetAllLinks(t *testing.T) { tomorrow := time.Now().Add(24 * time.Hour) yesterday := time.Now().Add(-24 * time.Hour) - link1, err := linkService.Save(ctx, *did, common.ToPointer(10), &tomorrow, importedSchema.ID, &tomorrow, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, &verifiable.RefreshService{ - ID: "https://refresh.xyz", - Type: verifiable.Iden3RefreshService2023, - }) + link1, err := linkService.Save(ctx, *did, common.ToPointer(10), &tomorrow, importedSchema.ID, &tomorrow, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, + &verifiable.RefreshService{ + ID: "https://refresh.xyz", + Type: verifiable.Iden3RefreshService2023, + }, + &verifiable.DisplayMethod{ + ID: "https://display.xyz", + Type: verifiable.Iden3BasicDisplayMethodV1, + }, + ) require.NoError(t, err) linkActive := getLinkResponse(*link1) time.Sleep(10 * time.Millisecond) - link2, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, &tomorrow, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, &verifiable.RefreshService{ - ID: "https://revreshv2.xyz", - Type: verifiable.Iden3RefreshService2023, - }) + link2, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, &tomorrow, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, + &verifiable.RefreshService{ + ID: "https://revreshv2.xyz", + Type: verifiable.Iden3RefreshService2023, + }, + &verifiable.DisplayMethod{ + ID: "https://display.xyz", + Type: verifiable.Iden3BasicDisplayMethodV1, + }, + ) require.NoError(t, err) linkExpired := getLinkResponse(*link2) require.NoError(t, err) time.Sleep(10 * time.Millisecond) - link3, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, &tomorrow, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link3, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, &tomorrow, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) link3.Active = false require.NoError(t, err) require.NoError(t, linkService.Activate(ctx, *did, link3.ID, false)) @@ -4054,7 +4066,7 @@ func TestServer_DeleteLink(t *testing.T) { validUntil := common.ToPointer(time.Date(2023, 8, 15, 14, 30, 45, 100, time.Local)) credentialExpiration := common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)) - link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) assert.NoError(t, err) handler := getHandler(ctx, server) @@ -4175,7 +4187,7 @@ func TestServer_DeleteLinkForDifferentDID(t *testing.T) { validUntil := common.ToPointer(time.Date(2023, 8, 15, 14, 30, 45, 100, time.Local)) credentialExpiration := common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)) - link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) assert.NoError(t, err) handler := getHandler(ctx, server) @@ -4284,11 +4296,11 @@ func TestServer_CreateLinkQRCode(t *testing.T) { validUntil := common.ToPointer(time.Now().Add(365 * 24 * time.Hour)) credentialExpiration := common.ToPointer(validUntil.Add(365 * 24 * time.Hour)) - link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) assert.NoError(t, err) yesterday := time.Now().Add(-24 * time.Hour) - linkExpired, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, nil, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + linkExpired, err := linkService.Save(ctx, *did, common.ToPointer(10), &yesterday, importedSchema.ID, nil, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) require.NoError(t, err) handler := getHandler(ctx, server) @@ -4471,7 +4483,7 @@ func TestServer_GetLinkQRCode(t *testing.T) { validUntil := common.ToPointer(time.Date(2023, 8, 15, 14, 30, 45, 0, time.Local)) credentialExpiration := common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 0, time.Local)) - link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link, err := linkService.Save(ctx, *did, common.ToPointer(10), validUntil, importedSchema.ID, credentialExpiration, true, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) assert.NoError(t, err) handler := getHandler(ctx, server) @@ -4679,7 +4691,7 @@ func TestServer_GetStateStatus(t *testing.T) { httpCode: http.StatusOK, }, cleanUp: func() { - cred, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) + cred, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, true, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) require.NoError(t, claimsService.Revoke(ctx, cfg.APIUI.IssuerDID, uint64(cred.RevNonce), "not valid")) }, @@ -4841,7 +4853,7 @@ func TestServer_GetRevocationStatus(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "index" schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" - createdCredential, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + createdCredential, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) require.NoError(t, err) handler := getHandler(ctx, server) diff --git a/internal/core/domain/link.go b/internal/core/domain/link.go index 604f5fb91..c693b8712 100644 --- a/internal/core/domain/link.go +++ b/internal/core/domain/link.go @@ -76,6 +76,7 @@ type Link struct { Schema *Schema IssuedClaims int // TODO: Give a value when link redemption is implemented RefreshService *verifiable.RefreshService + DisplayMethod *verifiable.DisplayMethod } // NewLink - Constructor @@ -89,6 +90,7 @@ func NewLink( credentialMTPProof bool, credentialSubject CredentialSubject, refreshService *verifiable.RefreshService, + displayMethod *verifiable.DisplayMethod, ) *Link { return &Link{ ID: uuid.New(), diff --git a/internal/core/ports/claims_service.go b/internal/core/ports/claims_service.go index d54e425ff..5389b21ea 100644 --- a/internal/core/ports/claims_service.go +++ b/internal/core/ports/claims_service.go @@ -35,6 +35,7 @@ type CreateClaimRequest struct { SchemaTypeDescription string RefreshService *verifiable.RefreshService RevNonce *uint64 + DisplayMethod *verifiable.DisplayMethod } // AgentRequest struct @@ -110,7 +111,7 @@ func NewClaimsFilter(schemaHash, schemaType, subject, queryField, queryValue *st } // NewCreateClaimRequest returns a new claim object with the given parameters -func NewCreateClaimRequest(did *w3c.DID, credentialSchema string, credentialSubject map[string]any, expiration *time.Time, typ string, cVersion *uint32, subjectPos *string, merklizedRootPosition *string, sigProof *bool, mtProof *bool, linkID *uuid.UUID, singleIssuer bool, credentialStatusType verifiable.CredentialStatusType, refreshService *verifiable.RefreshService, revNonce *uint64) *CreateClaimRequest { +func NewCreateClaimRequest(did *w3c.DID, credentialSchema string, credentialSubject map[string]any, expiration *time.Time, typ string, cVersion *uint32, subjectPos *string, merklizedRootPosition *string, sigProof *bool, mtProof *bool, linkID *uuid.UUID, singleIssuer bool, credentialStatusType verifiable.CredentialStatusType, refreshService *verifiable.RefreshService, revNonce *uint64, displayMethod *verifiable.DisplayMethod) *CreateClaimRequest { if sigProof == nil { sigProof = common.ToPointer(false) } @@ -127,6 +128,7 @@ func NewCreateClaimRequest(did *w3c.DID, credentialSchema string, credentialSubj SignatureProof: *sigProof, MTProof: *mtProof, RefreshService: refreshService, + DisplayMethod: displayMethod, } if expiration != nil { req.Expiration = expiration diff --git a/internal/core/ports/link_service.go b/internal/core/ports/link_service.go index 35df39434..1b06a589f 100644 --- a/internal/core/ports/link_service.go +++ b/internal/core/ports/link_service.go @@ -49,7 +49,7 @@ type GetQRCodeResponse struct { // LinkService - the interface that defines the available methods type LinkService interface { - Save(ctx context.Context, did w3c.DID, maxIssuance *int, validUntil *time.Time, schemaID uuid.UUID, credentialExpiration *time.Time, credentialSignatureProof bool, credentialMTPProof bool, credentialAttributes domain.CredentialSubject, refreshService *verifiable.RefreshService) (*domain.Link, error) + Save(ctx context.Context, did w3c.DID, maxIssuance *int, validUntil *time.Time, schemaID uuid.UUID, credentialExpiration *time.Time, credentialSignatureProof bool, credentialMTPProof bool, credentialAttributes domain.CredentialSubject, refreshService *verifiable.RefreshService, displayMethod *verifiable.DisplayMethod) (*domain.Link, error) Activate(ctx context.Context, issuerID w3c.DID, linkID uuid.UUID, active bool) error Delete(ctx context.Context, id uuid.UUID, did w3c.DID) error GetByID(ctx context.Context, issuerID w3c.DID, id uuid.UUID) (*domain.Link, error) diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 1511d1ad7..014acf55d 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -49,6 +49,9 @@ var ( ErrInvalidCredentialSubject = errors.New("credential subject does not match the provided schema") // ErrInvalidCredentialSubject means the credentialSubject does not match the schema provided ErrUnsupportedRefreshServiceType = errors.New("unsupported refresh service type") // ErrUnsupportedRefreshServiceType means the refresh service type is not supported ErrRefreshServiceLacksExpirationTime = errors.New("credential request with refresh service lacks expiration time") // ErrRefreshServiceLacksExpirationTime means the credential request includes a refresh service, but the expiration time is not set + ErrRefreshServiceLacksURL = errors.New("credential request with refresh service lacks url") // ErrRefreshServiceLacksURL means the credential request includes a refresh service, but the url is not set + ErrDisplayMethodLacksURL = errors.New("credential request with display method lacks url") // ErrDisplayMethodLacksURL means the credential request includes a display method, but the url is not set + ErrUnsupportedDisplayMethodType = errors.New("unsupported display method type") // ErrUnsupportedDisplayMethodType means the display method type is not supported ) type claim struct { @@ -668,10 +671,40 @@ func (c *claim) guardCreateClaimRequest(req *ports.CreateClaimRequest) error { if req.Expiration == nil { return ErrRefreshServiceLacksExpirationTime } - if req.RefreshService.Type != verifiable.Iden3RefreshService2023 { + if req.RefreshService.ID == "" { + return ErrRefreshServiceLacksURL + } + _, err := url.ParseRequestURI(req.RefreshService.ID) + if err != nil { + return ErrRefreshServiceLacksURL + } + + switch req.RefreshService.Type { + case verifiable.Iden3RefreshService2023: + return nil + default: return ErrUnsupportedRefreshServiceType } - return nil + }, + // check display method in correct uri + func() error { + if req.DisplayMethod == nil { + return nil + } + if req.DisplayMethod.ID == "" { + return ErrDisplayMethodLacksURL + } + _, err := url.ParseRequestURI(req.DisplayMethod.ID) + if err != nil { + return ErrDisplayMethodLacksURL + } + + switch req.DisplayMethod.Type { + case verifiable.Iden3BasicDisplayMethodV1: + return nil + default: + return ErrUnsupportedDisplayMethodType + } }, } @@ -711,6 +744,10 @@ func (c *claim) newVerifiableCredential(ctx context.Context, claimReq *ports.Cre return verifiable.W3CCredential{}, err } + if claimReq.DisplayMethod != nil { + credentialCtx = append(credentialCtx, verifiable.JSONLDSchemaIden3DisplayMethod) + } + issuanceDate := time.Now().UTC() return verifiable.W3CCredential{ ID: c.buildCredentialID(*claimReq.DID, vcID, claimReq.SingleIssuer), @@ -726,6 +763,7 @@ func (c *claim) newVerifiableCredential(ctx context.Context, claimReq *ports.Cre }, CredentialStatus: cs, RefreshService: claimReq.RefreshService, + DisplayMethod: claimReq.DisplayMethod, }, nil } diff --git a/internal/core/services/link.go b/internal/core/services/link.go index a9edbe793..47c9d3535 100644 --- a/internal/core/services/link.go +++ b/internal/core/services/link.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "net/url" "time" "github.com/google/uuid" @@ -84,6 +85,7 @@ func (ls *Link) Save( credentialMTPProof bool, credentialSubject domain.CredentialSubject, refreshService *verifiable.RefreshService, + displayMethod *verifiable.DisplayMethod, ) (*domain.Link, error) { schemaDB, err := ls.schemaRepository.GetByID(ctx, did, schemaID) if err != nil { @@ -98,8 +100,12 @@ func (ls *Link) Save( log.Error(ctx, "validating refresh service", "err", err) return nil, err } + if err = ls.validateDisplayMethod(displayMethod); err != nil { + log.Error(ctx, "validating display method", "err", err) + return nil, err + } - link := domain.NewLink(did, maxIssuance, validUntil, schemaID, credentialExpiration, credentialSignatureProof, credentialMTPProof, credentialSubject, refreshService) + link := domain.NewLink(did, maxIssuance, validUntil, schemaID, credentialExpiration, credentialSignatureProof, credentialMTPProof, credentialSubject, refreshService, displayMethod) _, err = ls.linkRepository.Save(ctx, ls.storage.Pgx, link) if err != nil { return nil, err @@ -257,6 +263,7 @@ func (ls *Link) IssueClaim(ctx context.Context, sessionID string, issuerDID w3c. credentialStatusType, link.RefreshService, nil, + link.DisplayMethod, ) credentialIssued, err := ls.claimsService.CreateCredential(ctx, claimReq) @@ -384,8 +391,39 @@ func (ls *Link) validateRefreshService(rs *verifiable.RefreshService, expiration if expiration == nil { return ErrRefreshServiceLacksExpirationTime } - if rs.Type != verifiable.Iden3RefreshService2023 { + + if rs.ID == "" { + return ErrRefreshServiceLacksURL + } + _, err := url.ParseRequestURI(rs.ID) + if err != nil { + return ErrRefreshServiceLacksURL + } + + switch rs.Type { + case verifiable.Iden3RefreshService2023: + return nil + default: return ErrUnsupportedRefreshServiceType } - return nil +} + +func (ls *Link) validateDisplayMethod(dm *verifiable.DisplayMethod) error { + if dm == nil { + return nil + } + + if dm.ID == "" { + return ErrDisplayMethodLacksURL + } + if _, err := url.ParseRequestURI(dm.ID); err != nil { + return ErrDisplayMethodLacksURL + } + + switch dm.Type { + case verifiable.Iden3BasicDisplayMethodV1: + return nil + default: + return ErrUnsupportedDisplayMethodType + } } diff --git a/internal/core/services/tests/identity_test.go b/internal/core/services/tests/identity_test.go index 867d33b11..ad0292aac 100644 --- a/internal/core/services/tests/identity_test.go +++ b/internal/core/services/tests/identity_test.go @@ -64,7 +64,7 @@ func Test_identity_UpdateState(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "index" - _, err = claimsService.Save(context.Background(), ports.NewCreateClaimRequest(did, schema, credentialSubject, common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + _, err = claimsService.Save(context.Background(), ports.NewCreateClaimRequest(did, schema, credentialSubject, common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) assert.NoError(t, err) type testConfig struct { diff --git a/internal/core/services/tests/link_test.go b/internal/core/services/tests/link_test.go index 600828e74..49bb6675a 100644 --- a/internal/core/services/tests/link_test.go +++ b/internal/core/services/tests/link_test.go @@ -67,7 +67,7 @@ func Test_link_issueClaim(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "index" - _, err = claimsService.Save(context.Background(), ports.NewCreateClaimRequest(did, schemaUrl, credentialSubject, common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil)) + _, err = claimsService.Save(context.Background(), ports.NewCreateClaimRequest(did, schemaUrl, credentialSubject, common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) assert.NoError(t, err) linkRepository := repositories.NewLink(*storage) @@ -77,10 +77,10 @@ func Test_link_issueClaim(t *testing.T) { tomorrow := time.Now().Add(24 * time.Hour) nextWeek := time.Now().Add(7 * 24 * time.Hour) - link, err := linkService.Save(ctx, *did, common.ToPointer(100), &tomorrow, schema.ID, &nextWeek, true, false, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link, err := linkService.Save(ctx, *did, common.ToPointer(100), &tomorrow, schema.ID, &nextWeek, true, false, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) assert.NoError(t, err) - link2, err := linkService.Save(ctx, *did, common.ToPointer(100), &tomorrow, schema.ID, &nextWeek, false, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil) + link2, err := linkService.Save(ctx, *did, common.ToPointer(100), &tomorrow, schema.ID, &nextWeek, false, true, domain.CredentialSubject{"birthday": 19791109, "documentType": 12}, nil, nil) assert.NoError(t, err) type expected struct { diff --git a/internal/db/schema/migrations/20240111024427_add_display_method_to_link_table.sql b/internal/db/schema/migrations/20240111024427_add_display_method_to_link_table.sql new file mode 100644 index 000000000..4385c118b --- /dev/null +++ b/internal/db/schema/migrations/20240111024427_add_display_method_to_link_table.sql @@ -0,0 +1,11 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE links + ADD COLUMN display_method JSONB NULL; +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +ALTER TABLE links + DROP COLUMN display_method; +-- +goose StatementEnd diff --git a/internal/repositories/link_repository.go b/internal/repositories/link_repository.go index 5df076209..f78138ab7 100644 --- a/internal/repositories/link_repository.go +++ b/internal/repositories/link_repository.go @@ -44,12 +44,12 @@ func (l link) Save(ctx context.Context, conn db.Querier, link *domain.Link) (*uu } var id uuid.UUID - sql := `INSERT INTO links (id, issuer_id, max_issuance, valid_until, schema_id, credential_expiration, credential_signature_proof, credential_mtp_proof, credential_attributes, active, refresh_service) - VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) ON CONFLICT (id) DO + sql := `INSERT INTO links (id, issuer_id, max_issuance, valid_until, schema_id, credential_expiration, credential_signature_proof, credential_mtp_proof, credential_attributes, active, refresh_service, display_method) + VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) ON CONFLICT (id) DO UPDATE SET issuer_id=$2, max_issuance=$3, valid_until=$4, schema_id=$5, credential_expiration=$6, credential_signature_proof=$7, credential_mtp_proof=$8, credential_attributes=$9, active=$10 RETURNING id` err := conn.QueryRow(ctx, sql, link.ID, link.IssuerCoreDID().String(), link.MaxIssuance, link.ValidUntil, link.SchemaID, link.CredentialExpiration, link.CredentialSignatureProof, - link.CredentialMTPProof, pgAttrs, link.Active, link.RefreshService).Scan(&id) + link.CredentialMTPProof, pgAttrs, link.Active, link.RefreshService, link.DisplayMethod).Scan(&id) if err != nil && strings.Contains(err.Error(), `table "links" violates foreign key constraint "links_schemas_id_key"`) { return nil, errorShemaNotFound @@ -71,6 +71,7 @@ SELECT links.id, links.credential_attributes, links.active, links.refresh_service, + links.display_method, count(claims.id) as issued_claims, schemas.id as schema_id, schemas.issuer_id as schema_issuer_id, @@ -101,6 +102,7 @@ GROUP BY links.id, schemas.id &credentialSubject, &link.Active, &link.RefreshService, + &link.DisplayMethod, &link.IssuedClaims, &s.ID, &s.IssuerID, @@ -143,6 +145,7 @@ SELECT links.id, links.credential_attributes, links.active, links.refresh_service, + links.display_method, count(claims.id) as issued_claims, schemas.id as schema_id, schemas.issuer_id as schema_issuer_id, @@ -205,6 +208,7 @@ WHERE links.issuer_id = $1 &link.CredentialMTPProof, &credentialAttributes, &link.Active, &link.RefreshService, + &link.DisplayMethod, &link.IssuedClaims, &schema.ID, &schema.IssuerID, diff --git a/internal/repositories/tests/claims_test.go b/internal/repositories/tests/claims_test.go index 72fbce360..531895d6b 100644 --- a/internal/repositories/tests/claims_test.go +++ b/internal/repositories/tests/claims_test.go @@ -602,7 +602,7 @@ func TestGetClaimsIssuedForUserID(t *testing.T) { tomorrow := time.Now().Add(24 * time.Hour) nextWeek := time.Now().Add(7 * 24 * time.Hour) - link := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil) + link := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil, nil) link.MaxIssuance = common.ToPointer(100) linkID, err := linkStore.Save(ctx, storage.Pgx, link) diff --git a/internal/repositories/tests/link_test.go b/internal/repositories/tests/link_test.go index a924d58a9..3994cdd16 100644 --- a/internal/repositories/tests/link_test.go +++ b/internal/repositories/tests/link_test.go @@ -36,10 +36,16 @@ func TestSaveLink(t *testing.T) { validUntil := time.Date(2050, 8, 15, 14, 30, 45, 100, time.Local) credentialExpiration := time.Date(2050, 8, 15, 14, 30, 45, 100, time.Local) - linkToSave := domain.NewLink(*did, common.ToPointer(10), &validUntil, schemaID, &credentialExpiration, true, false, domain.CredentialSubject{"birthday": 19790911, "documentType": 1}, &verifiable.RefreshService{ - ID: "https://refresh.xyz", - Type: verifiable.Iden3RefreshService2023, - }) + linkToSave := domain.NewLink(*did, common.ToPointer(10), &validUntil, schemaID, &credentialExpiration, true, false, domain.CredentialSubject{"birthday": 19790911, "documentType": 1}, + &verifiable.RefreshService{ + ID: "https://refresh.xyz", + Type: verifiable.Iden3RefreshService2023, + }, + &verifiable.DisplayMethod{ + ID: "https://display.xyz", + Type: verifiable.Iden3BasicDisplayMethodV1, + }, + ) linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) assert.NoError(t, err) @@ -53,6 +59,7 @@ func TestSaveLink(t *testing.T) { assert.Equal(t, linkToSave.CredentialSignatureProof, linkFetched.CredentialSignatureProof) assert.Equal(t, linkToSave.CredentialMTPProof, linkFetched.CredentialMTPProof) assert.Equal(t, linkToSave.RefreshService, linkFetched.RefreshService) + assert.Equal(t, linkToSave.DisplayMethod, linkFetched.DisplayMethod) tcCred, err := json.Marshal(linkToSave.CredentialSubject) require.NoError(t, err) respCred, err := json.Marshal(linkFetched.CredentialSubject) @@ -134,7 +141,7 @@ func TestGetLinkById(t *testing.T) { validUntil := time.Date(2050, 8, 15, 14, 30, 45, 100, time.Local) credentialExpiration := time.Date(2050, 8, 15, 14, 30, 45, 100, time.Local) - linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &validUntil, schemaID, &credentialExpiration, true, false, domain.CredentialSubject{}, nil) + linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &validUntil, schemaID, &credentialExpiration, true, false, domain.CredentialSubject{}, nil, nil) linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) assert.NoError(t, err) assert.NotNil(t, linkID) @@ -166,28 +173,28 @@ func TestGetAll(t *testing.T) { past := time.Now().Add(-100 * 24 * time.Hour) // 10 not expired links and no max issuance for i := 0; i < 10; i++ { - linkToSave := domain.NewLink(*did, nil, &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil) + linkToSave := domain.NewLink(*did, nil, &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil, nil) linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) require.NoError(t, err) assert.NotNil(t, linkID) } // 10 not expired links for i := 0; i < 10; i++ { - linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil) + linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil, nil) linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) require.NoError(t, err) assert.NotNil(t, linkID) } // 10 expired ones for i := 0; i < 10; i++ { - linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &past, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil) + linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &past, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil, nil) linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) require.NoError(t, err) assert.NotNil(t, linkID) } // 10 valid but over used for i := 0; i < 10; i++ { - linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil) + linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil, nil) linkToSave.MaxIssuance = common.ToPointer(100) linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) @@ -217,7 +224,7 @@ func TestGetAll(t *testing.T) { } // 10 inactive for i := 0; i < 10; i++ { - linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil) + linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &tomorrow, schemaID, &nextWeek, true, false, domain.CredentialSubject{}, nil, nil) linkToSave.Active = false linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) require.NoError(t, err) @@ -357,7 +364,7 @@ func TestDeleteLink(t *testing.T) { validUntil := time.Date(2050, 8, 15, 14, 30, 45, 100, time.Local) credentialExpiration := time.Date(2050, 8, 15, 14, 30, 45, 100, time.Local) - linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &validUntil, schemaID, &credentialExpiration, true, false, domain.CredentialSubject{}, nil) + linkToSave := domain.NewLink(*did, common.ToPointer[int](10), &validUntil, schemaID, &credentialExpiration, true, false, domain.CredentialSubject{}, nil, nil) linkID, err := linkStore.Save(ctx, storage.Pgx, linkToSave) assert.NoError(t, err) From 4c51e9ca79199b38624a32ba771cff0285b173e3 Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 11 Jan 2024 15:57:21 +0200 Subject: [PATCH 015/110] minor fixes --- internal/api_ui/responses.go | 9 +++++++++ internal/core/domain/link.go | 1 + 2 files changed, 10 insertions(+) diff --git a/internal/api_ui/responses.go b/internal/api_ui/responses.go index 1d8d18cb1..80b1df44d 100644 --- a/internal/api_ui/responses.go +++ b/internal/api_ui/responses.go @@ -105,6 +105,14 @@ func credentialResponse(w3c *verifiable.W3CCredential, credential *domain.Claim) } } + var displayService *DisplayMethod + if w3c.DisplayMethod != nil { + displayService = &DisplayMethod{ + Id: w3c.DisplayMethod.ID, + Type: DisplayMethodType(w3c.DisplayMethod.Type), + } + } + return Credential{ CredentialSubject: w3c.CredentialSubject, CreatedAt: TimeUTC(*w3c.IssuanceDate), @@ -120,6 +128,7 @@ func credentialResponse(w3c *verifiable.W3CCredential, credential *domain.Claim) UserID: credential.OtherIdentifier, SchemaTypeDescription: credential.SchemaTypeDescription, RefreshService: refreshService, + DisplayMethod: displayService, } } diff --git a/internal/core/domain/link.go b/internal/core/domain/link.go index c693b8712..2715a2546 100644 --- a/internal/core/domain/link.go +++ b/internal/core/domain/link.go @@ -105,6 +105,7 @@ func NewLink( Active: true, IssuedClaims: 0, RefreshService: refreshService, + DisplayMethod: displayMethod, } } From ec6e2a578b1b58ea095eb6c9a6850d2db8c19d62 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 11 Jan 2024 17:48:47 +0100 Subject: [PATCH 016/110] feat: Pagination in listing of connections --- ui/src/adapters/api/connections.ts | 32 ++++++--- .../connections/ConnectionsTable.tsx | 72 +++++++++++++++++-- .../credentials/CredentialIssuedQR.tsx | 2 +- .../credentials/CredentialLinkQR.tsx | 3 +- .../credentials/IssuanceMethodForm.tsx | 11 ++- 5 files changed, 101 insertions(+), 19 deletions(-) diff --git a/ui/src/adapters/api/connections.ts b/ui/src/adapters/api/connections.ts index 8b0db358f..b6ebae358 100644 --- a/ui/src/adapters/api/connections.ts +++ b/ui/src/adapters/api/connections.ts @@ -4,10 +4,15 @@ import { z } from "zod"; import { Response, buildErrorResponse, buildSuccessResponse } from "src/adapters"; import { Message, buildAuthorizationHeader, messageParser } from "src/adapters/api"; import { credentialParser } from "src/adapters/api/credentials"; -import { datetimeParser, getListParser, getStrictParser } from "src/adapters/parsers"; +import { + datetimeParser, + getListParser, + getResourceParser, + getStrictParser, +} from "src/adapters/parsers"; import { Connection, Env } from "src/domain"; import { API_VERSION, QUERY_SEARCH_PARAM } from "src/utils/constants"; -import { List } from "src/utils/types"; +import { Resource } from "src/utils/types"; type ConnectionInput = Omit & { createdAt: string; @@ -52,16 +57,18 @@ export async function getConnection({ export async function getConnections({ credentials, env, - params, + params: { max_results, page, query }, signal, }: { credentials: boolean; env: Env; - params?: { + params: { + max_results?: number; + page?: number; query?: string; }; signal?: AbortSignal; -}): Promise>> { +}): Promise>> { try { const response = await axios({ baseURL: env.api.url, @@ -70,17 +77,22 @@ export async function getConnections({ }, method: "GET", params: new URLSearchParams({ - ...(params?.query !== undefined ? { [QUERY_SEARCH_PARAM]: params?.query } : {}), + ...(query !== undefined ? { [QUERY_SEARCH_PARAM]: query } : {}), ...(credentials ? { credentials: "true" } : {}), + ...(max_results !== undefined ? { max_results: max_results.toString() } : {}), + ...(page !== undefined ? { page: page.toString() } : {}), }), signal, url: `${API_VERSION}/connections`, }); return buildSuccessResponse( - getListParser(connectionParser) - .transform(({ failed, successful }) => ({ - failed, - successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), + getResourceParser(connectionParser) + .transform(({ items: { failed, successful }, meta }) => ({ + items: { + failed, + successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), + }, + meta, })) .parse(response.data) ); diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index 92fb6d0a9..5e34e51f0 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -14,6 +14,7 @@ import { import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate, useSearchParams } from "react-router-dom"; +import { positiveIntegerFromStringParser } from "../../adapters/parsers"; import { getConnections } from "src/adapters/api/connections"; import IconCreditCardPlus from "src/assets/icons/credit-card-plus.svg?react"; import IconDots from "src/assets/icons/dots-vertical.svg?react"; @@ -32,11 +33,16 @@ import { AsyncTask, isAsyncTaskDataAvailable, isAsyncTaskStarting } from "src/ut import { isAbortedError, makeRequestAbortable } from "src/utils/browser"; import { CONNECTIONS, + DEFAULT_PAGINATION_MAX_RESULTS, + DEFAULT_PAGINATION_PAGE, + DEFAULT_PAGINATION_TOTAL, DELETE, DETAILS, DID_SEARCH_PARAM, IDENTIFIER, ISSUED_CREDENTIALS, + PAGINATION_MAX_RESULTS_PARAM, + PAGINATION_PAGE_PARAM, QUERY_SEARCH_PARAM, } from "src/utils/constants"; import { notifyParseErrors } from "src/utils/error"; @@ -53,6 +59,22 @@ export function ConnectionsTable() { const [searchParams, setSearchParams] = useSearchParams(); + const paginationPageParsed = positiveIntegerFromStringParser.safeParse( + searchParams.get(PAGINATION_PAGE_PARAM) + ); + const paginationMaxResultsParsed = positiveIntegerFromStringParser.safeParse( + searchParams.get(PAGINATION_MAX_RESULTS_PARAM) + ); + + const [paginationTotal, setPaginationTotal] = useState(DEFAULT_PAGINATION_TOTAL); + + const paginationPage = paginationPageParsed.success + ? paginationPageParsed.data + : DEFAULT_PAGINATION_PAGE; + const paginationMaxResults = paginationMaxResultsParsed.success + ? paginationMaxResultsParsed.data + : DEFAULT_PAGINATION_MAX_RESULTS; + const queryParam = searchParams.get(QUERY_SEARCH_PARAM); const tableColumns: TableColumnsType = [ @@ -134,6 +156,28 @@ export function ConnectionsTable() { }, ]; + const updatePaginationParams = useCallback( + (pagination: { maxResults?: number; page?: number }) => { + setSearchParams((previousParams) => { + const params = new URLSearchParams(previousParams); + params.set( + PAGINATION_PAGE_PARAM, + pagination.page !== undefined + ? pagination.page.toString() + : DEFAULT_PAGINATION_PAGE.toString() + ); + params.set( + PAGINATION_MAX_RESULTS_PARAM, + pagination.maxResults !== undefined + ? pagination.maxResults.toString() + : DEFAULT_PAGINATION_MAX_RESULTS.toString() + ); + return params; + }); + }, + [setSearchParams] + ); + const fetchConnections = useCallback( async (signal?: AbortSignal) => { setConnections({ status: "loading" }); @@ -141,20 +185,30 @@ export function ConnectionsTable() { credentials: true, env, params: { + max_results: paginationMaxResults, + page: paginationPage, query: queryParam || undefined, }, signal, }); if (response.success) { - setConnections({ data: response.data.successful, status: "successful" }); - notifyParseErrors(response.data.failed); + setConnections({ + data: response.data.items.successful, + status: "successful", + }); + setPaginationTotal(response.data.meta.total); + updatePaginationParams({ + maxResults: response.data.meta.max_results, + page: response.data.meta.page, + }); + notifyParseErrors(response.data.items.failed); } else { if (!isAbortedError(response.error)) { setConnections({ error: response.error, status: "failed" }); } } }, - [env, queryParam] + [env, paginationMaxResults, paginationPage, queryParam, updatePaginationParams] ); const onSearch = useCallback( @@ -233,7 +287,17 @@ export function ConnectionsTable() { ), }} - pagination={false} + onChange={({ current, pageSize, total }) => { + setPaginationTotal(total || DEFAULT_PAGINATION_TOTAL); + updatePaginationParams({ maxResults: pageSize, page: current }); + }} + pagination={{ + current: paginationPage, + hideOnSinglePage: true, + pageSize: paginationMaxResults, + position: ["bottomRight"], + total: paginationTotal, + }} rowKey="id" showSorterTooltip sortDirections={["ascend", "descend"]} diff --git a/ui/src/components/credentials/CredentialIssuedQR.tsx b/ui/src/components/credentials/CredentialIssuedQR.tsx index c54bf944a..75e700fb6 100644 --- a/ui/src/components/credentials/CredentialIssuedQR.tsx +++ b/ui/src/components/credentials/CredentialIssuedQR.tsx @@ -29,7 +29,7 @@ export function CredentialIssuedQR() { const response = await getIssuedQRCodes({ credentialID, env, signal }); if (response.success) { - setIssuedQRCodes({data: response.data, status: "successful"}); + setIssuedQRCodes({ data: response.data, status: "successful" }); } else { if (!isAbortedError(response.error)) { setIssuedQRCodes({ error: response.error, status: "failed" }); diff --git a/ui/src/components/credentials/CredentialLinkQR.tsx b/ui/src/components/credentials/CredentialLinkQR.tsx index 0738fcc0d..b94ec7dc4 100644 --- a/ui/src/components/credentials/CredentialLinkQR.tsx +++ b/ui/src/components/credentials/CredentialLinkQR.tsx @@ -239,7 +239,8 @@ export function CredentialLinkQR() { return ( diff --git a/ui/src/components/credentials/IssuanceMethodForm.tsx b/ui/src/components/credentials/IssuanceMethodForm.tsx index cc33c8773..3f17a28df 100644 --- a/ui/src/components/credentials/IssuanceMethodForm.tsx +++ b/ui/src/components/credentials/IssuanceMethodForm.tsx @@ -52,11 +52,16 @@ export function IssuanceMethodForm({ const fetchConnections = useCallback( async (signal: AbortSignal) => { - const response = await getConnections({ credentials: false, env, signal }); + const response = await getConnections({ + credentials: false, + env, + params: { max_results: 0 }, + signal, + }); if (response.success) { - setConnections({ data: response.data.successful, status: "successful" }); - notifyParseErrors(response.data.failed); + setConnections({ data: response.data.items.successful, status: "successful" }); + notifyParseErrors(response.data.items.failed); } else { setConnections({ error: response.error, status: "failed" }); } From 089671e0f66352c805c09fd4771ebb93fa9002b2 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 12 Jan 2024 13:52:18 +0100 Subject: [PATCH 017/110] feat: Link create endpoint return both qr code types --- api_ui/api.yaml | 18 +++-------- internal/api_ui/api.gen.go | 43 ++++--------------------- internal/api_ui/server.go | 16 ++++------ internal/api_ui/server_test.go | 58 +++++++--------------------------- ui/src/domain/credential.ts | 2 +- 5 files changed, 32 insertions(+), 105 deletions(-) diff --git a/api_ui/api.yaml b/api_ui/api.yaml index 6d7acaf36..852dcaf12 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -881,16 +881,6 @@ paths: summary: Create Authentication Link QRCode operationId: CreateLinkQrCode parameters: - - name: type - in: query - required: false - schema: - type: string - enum: [ raw, link ] - description: > - Type: - * `link` - (default value) Return a QR code with a link redirection to the raw content. Easier to scan. - * `raw` - Return the raw QR code. (default value) - $ref: '#/components/parameters/id' tags: - Links @@ -1154,19 +1144,21 @@ components: type: string example: https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld#KYCAgeCredential - CredentialLinkQrCodeResponse: type: object required: - issuer - - qrCode + - qrCodeLink + - qrCodeRaw - sessionID - linkID - linkDetail properties: issuer: $ref: '#/components/schemas/IssuerDescription' - qrCode: + qrCodeRaw: + type: string + qrCodeLink: type: string example: iden3comm://?request_uri=https%3A%2F%2Fissuer-demo.polygonid.me%2Fapi%2Fqr-store%3Fid%3Df780a169-8959-4380-9461-f7200e2ed3f4 sessionID: diff --git a/internal/api_ui/api.gen.go b/internal/api_ui/api.gen.go index cff370cce..eb690b432 100644 --- a/internal/api_ui/api.gen.go +++ b/internal/api_ui/api.gen.go @@ -84,12 +84,6 @@ const ( GetLinksParamsStatusInactive GetLinksParamsStatus = "inactive" ) -// Defines values for CreateLinkQrCodeParamsType. -const ( - CreateLinkQrCodeParamsTypeLink CreateLinkQrCodeParamsType = "link" - CreateLinkQrCodeParamsTypeRaw CreateLinkQrCodeParamsType = "raw" -) - // Defines values for GetCredentialQrCodeParamsType. const ( GetCredentialQrCodeParamsTypeLink GetCredentialQrCodeParamsType = "link" @@ -170,7 +164,8 @@ type Credential struct { type CredentialLinkQrCodeResponse struct { Issuer IssuerDescription `json:"issuer"` LinkDetail LinkSimple `json:"linkDetail"` - QrCode string `json:"qrCode"` + QrCodeLink string `json:"qrCodeLink"` + QrCodeRaw string `json:"qrCodeRaw"` SessionID string `json:"sessionID"` } @@ -519,17 +514,6 @@ type GetLinkQRCodeParams struct { SessionID SessionID `form:"sessionID" json:"sessionID"` } -// CreateLinkQrCodeParams defines parameters for CreateLinkQrCode. -type CreateLinkQrCodeParams struct { - // Type Type: - // * `link` - (default value) Return a QR code with a link redirection to the raw content. Easier to scan. - // * `raw` - Return the raw QR code. (default value) - Type *CreateLinkQrCodeParamsType `form:"type,omitempty" json:"type,omitempty"` -} - -// CreateLinkQrCodeParamsType defines parameters for CreateLinkQrCode. -type CreateLinkQrCodeParamsType string - // GetCredentialQrCodeParams defines parameters for GetCredentialQrCode. type GetCredentialQrCodeParams struct { // Type Type: @@ -646,7 +630,7 @@ type ServerInterface interface { GetLinkQRCode(w http.ResponseWriter, r *http.Request, id Id, params GetLinkQRCodeParams) // Create Authentication Link QRCode // (POST /v1/credentials/links/{id}/qrcode) - CreateLinkQrCode(w http.ResponseWriter, r *http.Request, id Id, params CreateLinkQrCodeParams) + CreateLinkQrCode(w http.ResponseWriter, r *http.Request, id Id) // Get Revocation Status // (GET /v1/credentials/revocation/status/{nonce}) GetRevocationStatus(w http.ResponseWriter, r *http.Request, nonce PathNonce) @@ -832,7 +816,7 @@ func (_ Unimplemented) GetLinkQRCode(w http.ResponseWriter, r *http.Request, id // Create Authentication Link QRCode // (POST /v1/credentials/links/{id}/qrcode) -func (_ Unimplemented) CreateLinkQrCode(w http.ResponseWriter, r *http.Request, id Id, params CreateLinkQrCodeParams) { +func (_ Unimplemented) CreateLinkQrCode(w http.ResponseWriter, r *http.Request, id Id) { w.WriteHeader(http.StatusNotImplemented) } @@ -1634,19 +1618,8 @@ func (siw *ServerInterfaceWrapper) CreateLinkQrCode(w http.ResponseWriter, r *ht return } - // Parameter object where we will unmarshal all parameters from the context - var params CreateLinkQrCodeParams - - // ------------- Optional query parameter "type" ------------- - - err = runtime.BindQueryParameter("form", true, false, "type", r.URL.Query(), ¶ms.Type) - if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "type", Err: err}) - return - } - handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.CreateLinkQrCode(w, r, id, params) + siw.Handler.CreateLinkQrCode(w, r, id) })) for _, middleware := range siw.HandlerMiddlewares { @@ -2986,8 +2959,7 @@ func (response GetLinkQRCode500JSONResponse) VisitGetLinkQRCodeResponse(w http.R } type CreateLinkQrCodeRequestObject struct { - Id Id `json:"id"` - Params CreateLinkQrCodeParams + Id Id `json:"id"` } type CreateLinkQrCodeResponseObject interface { @@ -4283,11 +4255,10 @@ func (sh *strictHandler) GetLinkQRCode(w http.ResponseWriter, r *http.Request, i } // CreateLinkQrCode operation middleware -func (sh *strictHandler) CreateLinkQrCode(w http.ResponseWriter, r *http.Request, id Id, params CreateLinkQrCodeParams) { +func (sh *strictHandler) CreateLinkQrCode(w http.ResponseWriter, r *http.Request, id Id) { var request CreateLinkQrCodeRequestObject request.Id = id - request.Params = params handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { return sh.ssi.CreateLinkQrCode(ctx, request.(CreateLinkQrCodeRequestObject)) diff --git a/internal/api_ui/server.go b/internal/api_ui/server.go index 335096fec..7f3641744 100644 --- a/internal/api_ui/server.go +++ b/internal/api_ui/server.go @@ -590,22 +590,20 @@ func (s *Server) CreateLinkQrCode(ctx context.Context, req CreateLinkQrCodeReque return CreateLinkQrCode500JSONResponse{N500JSONResponse{"Unexpected error while creating qr code"}}, nil } - qrContent := createLinkQrCodeResponse.QrCode // Backward compatibility. If the type is raw, we return the raw qr code - if req.Params.Type != nil && *req.Params.Type == CreateLinkQrCodeParamsTypeRaw { - rawQrCode, err := s.qrService.Find(ctx, createLinkQrCodeResponse.QrID) - if err != nil { - log.Error(ctx, "qr store. Finding qr", "err", err, "id", createLinkQrCodeResponse.QrID) - return CreateLinkQrCode500JSONResponse{N500JSONResponse{"error looking for qr body"}}, nil - } - qrContent = string(rawQrCode) + qrCodeRaw, err := s.qrService.Find(ctx, createLinkQrCodeResponse.QrID) + if err != nil { + log.Error(ctx, "qr store. Finding qr", "err", err, "id", createLinkQrCodeResponse.QrID) + return CreateLinkQrCode500JSONResponse{N500JSONResponse{"error looking for qr body"}}, nil } + return CreateLinkQrCode200JSONResponse{ Issuer: IssuerDescription{ DisplayName: s.cfg.APIUI.IssuerName, Logo: s.cfg.APIUI.IssuerLogo, }, - QrCode: qrContent, + QrCodeLink: createLinkQrCodeResponse.QrCode, + QrCodeRaw: string(qrCodeRaw), SessionID: createLinkQrCodeResponse.SessionID, LinkDetail: getLinkSimpleResponse(*createLinkQrCodeResponse.Link), }, nil diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 9b197605b..eb7eeca04 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -4298,7 +4298,6 @@ func TestServer_CreateLinkQRCode(t *testing.T) { type expected struct { linkDetail Link httpCode int - qrWithLink bool message string } @@ -4320,8 +4319,7 @@ func TestServer_CreateLinkQRCode(t *testing.T) { { name: "Expired link", request: CreateLinkQrCodeRequestObject{ - Id: linkExpired.ID, - Params: CreateLinkQrCodeParams{Type: nil}, + Id: linkExpired.ID, }, expected: expected{ httpCode: http.StatusNotFound, @@ -4329,38 +4327,12 @@ func TestServer_CreateLinkQRCode(t *testing.T) { }, }, { - name: "Happy path without qr type, expecting a qr code with link", - request: CreateLinkQrCodeRequestObject{ - Id: link.ID, - Params: CreateLinkQrCodeParams{Type: nil}, - }, - expected: expected{ - linkDetail: linkDetail, - qrWithLink: true, - httpCode: http.StatusOK, - }, - }, - { - name: "Happy path with qr type == link", - request: CreateLinkQrCodeRequestObject{ - Id: link.ID, - Params: CreateLinkQrCodeParams{Type: common.ToPointer(CreateLinkQrCodeParamsTypeLink)}, - }, - expected: expected{ - linkDetail: linkDetail, - qrWithLink: true, - httpCode: http.StatusOK, - }, - }, - { - name: "Happy path with qr type == raw", + name: "Happy path", request: CreateLinkQrCodeRequestObject{ - Id: link.ID, - Params: CreateLinkQrCodeParams{Type: common.ToPointer(CreateLinkQrCodeParamsTypeRaw)}, + Id: link.ID, }, expected: expected{ linkDetail: linkDetail, - qrWithLink: false, httpCode: http.StatusOK, }, }, @@ -4368,9 +4340,6 @@ func TestServer_CreateLinkQRCode(t *testing.T) { t.Run(tc.name, func(t *testing.T) { rr := httptest.NewRecorder() apiURL := fmt.Sprintf("/v1/credentials/links/%s/qrcode", tc.request.Id.String()) - if tc.request.Params.Type != nil { - apiURL = apiURL + "?type=" + string(*tc.request.Params.Type) - } req, err := http.NewRequest(http.MethodPost, apiURL, tests.JSONBody(t, nil)) require.NoError(t, err) @@ -4386,20 +4355,17 @@ func TestServer_CreateLinkQRCode(t *testing.T) { require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) realQR := protocol.AuthorizationRequestMessage{} - if tc.expected.qrWithLink { - qrLink := checkQRfetchURL(t, response.QrCode) - // Now let's fetch the original QR using the url - rr := httptest.NewRecorder() - req, err := http.NewRequest(http.MethodGet, qrLink, nil) - require.NoError(t, err) - handler.ServeHTTP(rr, req) - require.Equal(t, http.StatusOK, rr.Code) + qrLink := checkQRfetchURL(t, response.QrCodeLink) - require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &realQR)) - } else { - require.NoError(t, json.Unmarshal([]byte(response.QrCode), &realQR)) - } + // Now let's fetch the original QR using the url + rr := httptest.NewRecorder() + req, err := http.NewRequest(http.MethodGet, qrLink, nil) + require.NoError(t, err) + handler.ServeHTTP(rr, req) + require.Equal(t, http.StatusOK, rr.Code) + + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &realQR)) assert.NotNil(t, realQR.Body) assert.Equal(t, "authentication", realQR.Body.Reason) diff --git a/ui/src/domain/credential.ts b/ui/src/domain/credential.ts index 090b58a88..b1e129ced 100644 --- a/ui/src/domain/credential.ts +++ b/ui/src/domain/credential.ts @@ -18,7 +18,7 @@ export type Credential = { }; export type IssuedQRCode = { - qrCodeLink: string; + qrCodeLink: string; // TODO: rename to qrCode schemaType: string; }; From 2920aee0569958605de680fe0bf3ac3438386676 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 12 Jan 2024 15:47:39 +0100 Subject: [PATCH 018/110] feat: Link QR show both types of qr: link and raw --- ui/src/adapters/api/credentials.ts | 6 ++++-- ui/src/components/credentials/CredentialLinkQR.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index e7f976437..ab47e6bbd 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -396,14 +396,16 @@ type AuthQRCodeInput = Omit & { export type AuthQRCode = { linkDetail: { proofTypes: ProofType[]; schemaType: string }; - qrCode: string; + qrCodeLink: string; + qrCodeRaw: string; sessionID: string; }; const authQRCodeParser = getStrictParser()( z.object({ linkDetail: z.object({ proofTypes: proofTypeParser, schemaType: z.string() }), - qrCode: z.string(), + qrCodeLink: z.string(), + qrCodeRaw: z.string(), sessionID: z.string(), }) ); diff --git a/ui/src/components/credentials/CredentialLinkQR.tsx b/ui/src/components/credentials/CredentialLinkQR.tsx index b94ec7dc4..761654017 100644 --- a/ui/src/components/credentials/CredentialLinkQR.tsx +++ b/ui/src/components/credentials/CredentialLinkQR.tsx @@ -239,8 +239,8 @@ export function CredentialLinkQR() { return ( From d87966465109bf38359af021f074105c4e1fd285 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 12 Jan 2024 16:05:16 +0100 Subject: [PATCH 019/110] chore: Rename IssuedQRCode.qrLink to IssuedQRCode.qrCode --- ui/src/adapters/api/credentials.ts | 2 +- ui/src/components/credentials/CredentialIssuedQR.tsx | 4 ++-- ui/src/domain/credential.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index ab47e6bbd..660308cd7 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -436,7 +436,7 @@ const issuedQRCodeParser = getStrictParser()( z.object({ qrCodeLink: z.string(), schemaType: z.string(), - }) + }).transform(({ qrCodeLink, schemaType }) => ({qrCode: qrCodeLink, schemaType})) ); export async function getIssuedQRCodes({ diff --git a/ui/src/components/credentials/CredentialIssuedQR.tsx b/ui/src/components/credentials/CredentialIssuedQR.tsx index 75e700fb6..a6e4e142e 100644 --- a/ui/src/components/credentials/CredentialIssuedQR.tsx +++ b/ui/src/components/credentials/CredentialIssuedQR.tsx @@ -68,8 +68,8 @@ export function CredentialIssuedQR() { const [issuedQRCodeLink, issuedQRCodeRaw] = issuedQRCodes.data; return ( diff --git a/ui/src/domain/credential.ts b/ui/src/domain/credential.ts index b1e129ced..77526cdfa 100644 --- a/ui/src/domain/credential.ts +++ b/ui/src/domain/credential.ts @@ -18,7 +18,7 @@ export type Credential = { }; export type IssuedQRCode = { - qrCodeLink: string; // TODO: rename to qrCode + qrCode: string; schemaType: string; }; From ef365e92dd2d7e9aa49ad77e9dbb5673a19e7c11 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 12 Jan 2024 17:59:05 +0200 Subject: [PATCH 020/110] use v2.1.2 for go-schema-processor v2 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index fb8f0421f..e070fbf46 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 - github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240111003118-4f6fe4efdb18 + github.com/iden3/go-schema-processor/v2 v2.1.2 github.com/iden3/iden3comm/v2 v2.0.0 github.com/iden3/merkletree-proof v0.0.4 github.com/ipfs/go-ipfs-api v0.7.0 diff --git a/go.sum b/go.sum index c424a7a63..b59807985 100644 --- a/go.sum +++ b/go.sum @@ -518,6 +518,8 @@ github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240109232752-0fb9c04b0407 h1: github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240109232752-0fb9c04b0407/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240111003118-4f6fe4efdb18 h1:6ojrFj6RTLgYOC+PPBdlCbK73aipWPNHhBRMlEIKW2U= github.com/iden3/go-schema-processor/v2 v2.1.2-0.20240111003118-4f6fe4efdb18/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= +github.com/iden3/go-schema-processor/v2 v2.1.2 h1:ghyhAvywq+FfFd5xo8x7BHbvvxK6OtvKO8Bch+P+oFg= +github.com/iden3/go-schema-processor/v2 v2.1.2/go.mod h1:wIa6h8BPWnXBImIIElYu5eLVW513pHjyTOj6KyVHenQ= github.com/iden3/iden3comm/v2 v2.0.0 h1:cFDfF6aJ589ENg5zlTBEPK6Qqv4I11C/gliAWZORpyY= github.com/iden3/iden3comm/v2 v2.0.0/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= From 977ec1eabc60c57a4ba45303949dcaad2e48fb77 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 12 Jan 2024 18:38:10 +0100 Subject: [PATCH 021/110] chore: Update go-multiaddr library to v0.12.1 --- go.mod | 6 +++--- go.sum | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fa325a8e0..18a60a092 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,7 @@ require ( github.com/pressly/goose/v3 v3.15.1 github.com/spf13/viper v1.17.0 github.com/stretchr/testify v1.8.4 - golang.org/x/crypto v0.15.0 + golang.org/x/crypto v0.17.0 golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 ) @@ -232,7 +232,7 @@ require ( github.com/moricho/tparallel v0.3.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.11.0 // indirect + github.com/multiformats/go-multiaddr v0.12.1 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect @@ -322,7 +322,7 @@ require ( golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.18.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.15.0 // indirect diff --git a/go.sum b/go.sum index 33d42f6ca..344640227 100644 --- a/go.sum +++ b/go.sum @@ -742,6 +742,8 @@ github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9 github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= +github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk= +github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= @@ -1069,6 +1071,8 @@ golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58 golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1278,6 +1282,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= From 70ea98590f3fcac47f8372099740597be8fd9941 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Tue, 16 Jan 2024 17:26:23 +0100 Subject: [PATCH 022/110] feat: Credential refresh service field in create claim screen --- ui/src/adapters/api/credentials.ts | 4 +++ ui/src/adapters/parsers/forms.ts | 23 ++++++++++++++-- .../credentials/IssueCredential.tsx | 4 +++ .../credentials/IssueCredentialForm.tsx | 26 +++++++++++++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 0ca962f49..7cb583930 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -127,6 +127,10 @@ export async function getCredentials({ export type CreateCredential = { credentialSchema: string; + credentialRefreshService: { + id: string; + type: "Iden3RefreshService2023"; + } | null; credentialSubject: Json; expiration: string | null; mtProof: boolean; diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 62704c509..90eeeb028 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -24,6 +24,7 @@ type FormInput = { [key: string]: FormLiteralInput | FormInput }; type CredentialIssuance = { credentialExpiration: Date | undefined; + credentialRefreshService: string | undefined; credentialSubject: Record | undefined; mtProof: boolean; signatureProof: boolean; @@ -116,6 +117,7 @@ export type IssueCredentialFormData = { credentialExpiration?: dayjs.Dayjs | null; credentialSubject?: Record; proofTypes: ProofType[]; + refreshService: { enabled: boolean; url: string }; schemaID?: string; }; @@ -126,6 +128,7 @@ const issueCredentialFormDataParser = getStrictParser() proofTypes: z .array(z.union([z.literal("MTP"), z.literal("SIG")])) .min(1, "At least one proof type is required"), + refreshService: z.object({ enabled: z.boolean(), url: z.string().url() }), schemaID: z.string().optional(), }) ); @@ -145,8 +148,10 @@ export const credentialFormParser = getStrictParser< issueCredential: issueCredentialFormDataParser, }) .transform(({ issuanceMethod, issueCredential }, context) => { - const { credentialExpiration, credentialSubject, proofTypes } = issueCredential; + const { credentialExpiration, credentialSubject, proofTypes, refreshService } = + issueCredential; const { type } = issuanceMethod; + console.log("lala", issueCredential, refreshService); const baseIssuance = { credentialExpiration: credentialExpiration ? credentialExpiration.toDate() : undefined, @@ -196,6 +201,7 @@ export const credentialFormParser = getStrictParser< ...baseIssuance, did: issuanceMethod.did, type, + credentialRefreshService: refreshService.enabled ? refreshService.url : null, }; } }) @@ -339,7 +345,14 @@ export function serializeCredentialLinkIssuance({ export function serializeCredentialIssuance({ attribute, credentialSchema, - issueCredential: { credentialExpiration, credentialSubject, did, mtProof, signatureProof }, + issueCredential: { + credentialExpiration, + credentialRefreshService, + credentialSubject, + did, + mtProof, + signatureProof, + }, type, }: { attribute: ObjectAttribute; @@ -358,6 +371,12 @@ export function serializeCredentialIssuance({ return { data: { credentialSchema, + credentialRefreshService: credentialRefreshService + ? { + id: credentialRefreshService, + type: "Iden3RefreshService2023", + } + : null, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: credentialExpiration ? dayjs(credentialExpiration).toISOString() : null, mtProof, diff --git a/ui/src/components/credentials/IssueCredential.tsx b/ui/src/components/credentials/IssueCredential.tsx index 142aabbfe..9914da029 100644 --- a/ui/src/components/credentials/IssueCredential.tsx +++ b/ui/src/components/credentials/IssueCredential.tsx @@ -118,6 +118,7 @@ export function IssueCredential() { }) => { const credentialSubjectAttributeWithoutId = extractCredentialSubjectAttributeWithoutId(jsonSchema); + console.log("lala3", credentialSubjectAttributeWithoutId); if (schemaID && credentialSubjectAttributeWithoutId) { setLinkID({ status: "loading" }); @@ -171,6 +172,7 @@ export function IssueCredential() { }); if (serializedCredentialForm.success) { + console.log("lala2", serializedCredentialForm.data); const response = await createCredential({ env, payload: serializedCredentialForm.data, @@ -260,6 +262,7 @@ export function IssueCredential() { setCredentialFormInput(newCredentialFormInput); const parsedForm = credentialFormParser.safeParse(newCredentialFormInput); + console.log("lala1", newCredentialFormInput.issueCredential); // TODO: LALA: remove if (parsedForm.success) { if (parsedForm.data.type === "credentialLink") { @@ -268,6 +271,7 @@ export function IssueCredential() { jsonSchema, }); } else { + console.log("form lala", parsedForm.data); void issueCredential({ apiSchema, credentialIssuance: parsedForm.data, diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 22f16d7f5..83b215545 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -101,6 +101,8 @@ export function IssueCredentialForm({ const [inputErrors, setInputErrors] = useState(); + const [refreshServiceChecked, setRefreshServiceChecked] = useState(false); + function isFormValid(value: Record, objectAttribute: ObjectAttribute): boolean { if (isAsyncTaskDataAvailable(jsonSchema)) { const serializedSchemaForm = serializeSchemaForm({ @@ -396,6 +398,7 @@ export function IssueCredentialForm({ case "successful": { const credentialSubjectAttributeWithoutId = extractCredentialSubjectAttributeWithoutId(jsonSchema.data); + return credentialSubjectAttributeWithoutId?.schema.attributes ? ( <> {jsonSchema.data.schema.description && ( @@ -410,6 +413,29 @@ export function IssueCredentialForm({ inputErrors={inputErrors} /> + + + { + setRefreshServiceChecked(!refreshServiceChecked); + }} + > + Enable Credential Refresh Service + + + + + + + Date: Wed, 17 Jan 2024 15:38:00 +0100 Subject: [PATCH 023/110] fix: Create credential parser now accepts empty input for url --- ui/src/adapters/api/credentials.ts | 2 +- ui/src/adapters/parsers/forms.ts | 8 ++++---- ui/src/components/credentials/IssueCredential.tsx | 2 ++ ui/src/components/credentials/IssueCredentialForm.tsx | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 7cb583930..5784e1383 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -126,11 +126,11 @@ export async function getCredentials({ } export type CreateCredential = { - credentialSchema: string; credentialRefreshService: { id: string; type: "Iden3RefreshService2023"; } | null; + credentialSchema: string; credentialSubject: Json; expiration: string | null; mtProof: boolean; diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 90eeeb028..e6ac8ae34 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -24,7 +24,7 @@ type FormInput = { [key: string]: FormLiteralInput | FormInput }; type CredentialIssuance = { credentialExpiration: Date | undefined; - credentialRefreshService: string | undefined; + credentialRefreshService: string | null; credentialSubject: Record | undefined; mtProof: boolean; signatureProof: boolean; @@ -128,7 +128,7 @@ const issueCredentialFormDataParser = getStrictParser() proofTypes: z .array(z.union([z.literal("MTP"), z.literal("SIG")])) .min(1, "At least one proof type is required"), - refreshService: z.object({ enabled: z.boolean(), url: z.string().url() }), + refreshService: z.object({ enabled: z.boolean(), url: z.union([z.literal(""), z.string().url()]) }), schemaID: z.string().optional(), }) ); @@ -155,6 +155,7 @@ export const credentialFormParser = getStrictParser< const baseIssuance = { credentialExpiration: credentialExpiration ? credentialExpiration.toDate() : undefined, + credentialRefreshService: refreshService.enabled ? refreshService.url : null, credentialSubject, mtProof: proofTypes.includes("MTP"), signatureProof: proofTypes.includes("SIG"), @@ -201,7 +202,6 @@ export const credentialFormParser = getStrictParser< ...baseIssuance, did: issuanceMethod.did, type, - credentialRefreshService: refreshService.enabled ? refreshService.url : null, }; } }) @@ -370,13 +370,13 @@ export function serializeCredentialIssuance({ if (serializedSchemaForm.success) { return { data: { - credentialSchema, credentialRefreshService: credentialRefreshService ? { id: credentialRefreshService, type: "Iden3RefreshService2023", } : null, + credentialSchema, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: credentialExpiration ? dayjs(credentialExpiration).toISOString() : null, mtProof, diff --git a/ui/src/components/credentials/IssueCredential.tsx b/ui/src/components/credentials/IssueCredential.tsx index 9914da029..436c5594b 100644 --- a/ui/src/components/credentials/IssueCredential.tsx +++ b/ui/src/components/credentials/IssueCredential.tsx @@ -41,6 +41,7 @@ const defaultCredentialFormInput: CredentialFormInput = { }, issueCredential: { proofTypes: ["SIG"], + refreshService: { enabled: false, url: "" } }, }; @@ -279,6 +280,7 @@ export function IssueCredential() { }); } } else { + console.log("parsedForm.error", parsedForm.error); // TODO: LALA: remove notifyParseError(parsedForm.error); } }} diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 83b215545..399fbfa4d 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -9,11 +9,12 @@ import { DatePicker, Divider, Form, + Input, Row, Select, Space, Typography, - message, + message } from "antd"; import { Store } from "antd/es/form/interface"; import dayjs from "dayjs"; From 1f79ff3bc745dcad5a1a769f3239337ca16e6d20 Mon Sep 17 00:00:00 2001 From: Javi Date: Wed, 17 Jan 2024 16:09:50 +0100 Subject: [PATCH 024/110] chore: updating go-schema-processor library (#602) --- go.mod | 4 ++-- go.sum | 14 ++++---------- internal/loader/w3c_loader.go | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 18a60a092..b4c6a5e1c 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f github.com/iden3/go-circuits/v2 v2.0.0 github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 - github.com/iden3/go-iden3-core/v2 v2.0.0 + github.com/iden3/go-iden3-core/v2 v2.0.3 github.com/iden3/go-iden3-crypto v0.0.15 github.com/iden3/go-jwz/v2 v2.0.0 github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 @@ -30,7 +30,7 @@ require ( github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 - github.com/iden3/go-schema-processor/v2 v2.1.0 + github.com/iden3/go-schema-processor/v2 v2.2.0 github.com/iden3/iden3comm/v2 v2.0.0 github.com/iden3/merkletree-proof v0.0.4 github.com/ipfs/go-ipfs-api v0.7.0 diff --git a/go.sum b/go.sum index 344640227..82415d4b0 100644 --- a/go.sum +++ b/go.sum @@ -486,8 +486,8 @@ github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 h1:r5vjH+MyPFzaJ7U62SO5Gz9N9O0RZ github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2/go.mod h1:bYr47aev7sh23RL7Ru+TQQSlYDS94+wO8P8SDrwdifc= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= -github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA= -github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= +github.com/iden3/go-iden3-core/v2 v2.0.3 h1:ce9Jbw10zDsinWXFc05SiK2Hof/wu4zV4/ai5gQy29k= +github.com/iden3/go-iden3-core/v2 v2.0.3/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= github.com/iden3/go-jwz/v2 v2.0.0 h1:VsU2PrmcchPMx/V0IhamMZRNjiQYZoyJopO8K8uSZOY= @@ -508,8 +508,8 @@ github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e/go.mod h1:UEBifEzw62T6VzIHJeHuUgeLg2U/J9ttf7hOwQEqnYk= github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFLPTEqnOIvlM= github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= -github.com/iden3/go-schema-processor/v2 v2.1.0 h1:8/fA7IVkyVmpbJij9Ar0X2zWPQJMlCaaPP4hfTZqbqU= -github.com/iden3/go-schema-processor/v2 v2.1.0/go.mod h1:EogHwnFnxQKOGRVme6upCcisoAQeEIl+HuRAGa7w3+w= +github.com/iden3/go-schema-processor/v2 v2.2.0 h1:sYPqLs72pEWXIfF0/MOv9AFm3+IGutRM3yClWRrjheg= +github.com/iden3/go-schema-processor/v2 v2.2.0/go.mod h1:Ovsrk0839NZgHtoW4hVLAmHoOsHAQZuVNUXd7sIOkLQ= github.com/iden3/iden3comm/v2 v2.0.0 h1:cFDfF6aJ589ENg5zlTBEPK6Qqv4I11C/gliAWZORpyY= github.com/iden3/iden3comm/v2 v2.0.0/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= @@ -740,8 +740,6 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= -github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk= github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= @@ -1069,8 +1067,6 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1280,8 +1276,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= diff --git a/internal/loader/w3c_loader.go b/internal/loader/w3c_loader.go index 8aba952f6..cf10ba3bc 100644 --- a/internal/loader/w3c_loader.go +++ b/internal/loader/w3c_loader.go @@ -14,9 +14,9 @@ type W3CDocumentLoader struct { } // NewW3CDocumentLoader creates a new document loader with a predefined http schema -func NewW3CDocumentLoader(ipfsCli *shell.Shell, ipfsGW string) ld.DocumentLoader { +func NewW3CDocumentLoader(_ *shell.Shell, ipfsGW string) ld.DocumentLoader { return &W3CDocumentLoader{ - l: loaders.NewDocumentLoader(ipfsCli, ipfsGW), + l: loaders.NewDocumentLoader(nil, ipfsGW), } } From b746fadee9d46efd4cd1b4a61f414e8873093a92 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 17 Jan 2024 17:45:31 +0100 Subject: [PATCH 025/110] feat: Send RefreshCredentialService on link creation --- ui/src/adapters/api/credentials.ts | 1 + ui/src/adapters/parsers/forms.ts | 16 ++++++++++++++-- .../components/credentials/IssueCredential.tsx | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 5784e1383..6d7a48469 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -351,6 +351,7 @@ export async function deleteLink({ export type CreateLink = { credentialExpiration: string | null; + credentialRefreshService: string | null; credentialSubject: Json; expiration: string | null; limitedClaims: number | null; diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index e6ac8ae34..ea959bdcb 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -36,6 +36,7 @@ export type CredentialDirectIssuance = CredentialIssuance & { }; export type CredentialLinkIssuance = CredentialIssuance & { + credentialRefreshService: string | null; linkAccessibleUntil: Date | undefined; linkMaximumIssuance: number | undefined; type: "credentialLink"; @@ -117,7 +118,7 @@ export type IssueCredentialFormData = { credentialExpiration?: dayjs.Dayjs | null; credentialSubject?: Record; proofTypes: ProofType[]; - refreshService: { enabled: boolean; url: string }; + refreshService: {enabled: boolean, url: string}; schemaID?: string; }; @@ -128,7 +129,16 @@ const issueCredentialFormDataParser = getStrictParser() proofTypes: z .array(z.union([z.literal("MTP"), z.literal("SIG")])) .min(1, "At least one proof type is required"), - refreshService: z.object({ enabled: z.boolean(), url: z.union([z.literal(""), z.string().url()]) }), + refreshService: z.union([ + z.object({ + enabled: z.literal(false), + url: z.string(), + }), + z.object({ + enabled: z.literal(true), + url: z.string().url() + }), + ]), schemaID: z.string().optional(), }) ); @@ -306,6 +316,7 @@ export function serializeCredentialLinkIssuance({ attribute, issueCredential: { credentialExpiration, + credentialRefreshService, credentialSubject, linkAccessibleUntil, linkMaximumIssuance, @@ -328,6 +339,7 @@ export function serializeCredentialLinkIssuance({ credentialExpiration: credentialExpiration ? serializeDate(credentialExpiration, "date") : null, + credentialRefreshService: credentialRefreshService, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: linkAccessibleUntil ? linkAccessibleUntil.toISOString() : null, limitedClaims: linkMaximumIssuance ?? null, diff --git a/ui/src/components/credentials/IssueCredential.tsx b/ui/src/components/credentials/IssueCredential.tsx index 436c5594b..1ac242327 100644 --- a/ui/src/components/credentials/IssueCredential.tsx +++ b/ui/src/components/credentials/IssueCredential.tsx @@ -119,7 +119,7 @@ export function IssueCredential() { }) => { const credentialSubjectAttributeWithoutId = extractCredentialSubjectAttributeWithoutId(jsonSchema); - console.log("lala3", credentialSubjectAttributeWithoutId); + console.log("lala3", credentialLinkIssuance); if (schemaID && credentialSubjectAttributeWithoutId) { setLinkID({ status: "loading" }); @@ -267,12 +267,12 @@ export function IssueCredential() { if (parsedForm.success) { if (parsedForm.data.type === "credentialLink") { + console.log("form lala", parsedForm.data); void createCredentialLink({ credentialLinkIssuance: parsedForm.data, jsonSchema, }); } else { - console.log("form lala", parsedForm.data); void issueCredential({ apiSchema, credentialIssuance: parsedForm.data, From 559705478dcc69517745d7acc9bd72dde206bf38 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 17 Jan 2024 17:47:53 +0100 Subject: [PATCH 026/110] chore: remove debug logs --- ui/src/adapters/parsers/forms.ts | 1 - ui/src/components/credentials/IssueCredential.tsx | 5 ----- 2 files changed, 6 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index ea959bdcb..0f00a34f9 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -161,7 +161,6 @@ export const credentialFormParser = getStrictParser< const { credentialExpiration, credentialSubject, proofTypes, refreshService } = issueCredential; const { type } = issuanceMethod; - console.log("lala", issueCredential, refreshService); const baseIssuance = { credentialExpiration: credentialExpiration ? credentialExpiration.toDate() : undefined, diff --git a/ui/src/components/credentials/IssueCredential.tsx b/ui/src/components/credentials/IssueCredential.tsx index 1ac242327..87072571a 100644 --- a/ui/src/components/credentials/IssueCredential.tsx +++ b/ui/src/components/credentials/IssueCredential.tsx @@ -119,7 +119,6 @@ export function IssueCredential() { }) => { const credentialSubjectAttributeWithoutId = extractCredentialSubjectAttributeWithoutId(jsonSchema); - console.log("lala3", credentialLinkIssuance); if (schemaID && credentialSubjectAttributeWithoutId) { setLinkID({ status: "loading" }); @@ -173,7 +172,6 @@ export function IssueCredential() { }); if (serializedCredentialForm.success) { - console.log("lala2", serializedCredentialForm.data); const response = await createCredential({ env, payload: serializedCredentialForm.data, @@ -263,11 +261,9 @@ export function IssueCredential() { setCredentialFormInput(newCredentialFormInput); const parsedForm = credentialFormParser.safeParse(newCredentialFormInput); - console.log("lala1", newCredentialFormInput.issueCredential); // TODO: LALA: remove if (parsedForm.success) { if (parsedForm.data.type === "credentialLink") { - console.log("form lala", parsedForm.data); void createCredentialLink({ credentialLinkIssuance: parsedForm.data, jsonSchema, @@ -280,7 +276,6 @@ export function IssueCredential() { }); } } else { - console.log("parsedForm.error", parsedForm.error); // TODO: LALA: remove notifyParseError(parsedForm.error); } }} From 9c7a0eac3c723c851410541907fa6f69406da655 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 18 Jan 2024 11:20:14 +0100 Subject: [PATCH 027/110] fix: Rename refreshService parameter when creating Credential --- internal/api_ui/api.gen.go | 4 ++-- ui/src/adapters/api/credentials.ts | 4 ++-- ui/src/adapters/parsers/forms.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/api_ui/api.gen.go b/internal/api_ui/api.gen.go index cff370cce..d184fecef 100644 --- a/internal/api_ui/api.gen.go +++ b/internal/api_ui/api.gen.go @@ -156,7 +156,7 @@ type Credential struct { ExpiresAt *TimeUTC `json:"expiresAt"` Id uuid.UUID `json:"id"` ProofTypes []string `json:"proofTypes"` - RefreshService *RefreshService `json:"refreshService,omitempty"` + RefreshService *RefreshService `json:"refreshService"` RevNonce uint64 `json:"revNonce"` Revoked bool `json:"revoked"` SchemaHash string `json:"schemaHash"` @@ -252,7 +252,7 @@ type Link struct { IssuedClaims int `json:"issuedClaims"` MaxIssuance *int `json:"maxIssuance"` ProofTypes []string `json:"proofTypes"` - RefreshService *RefreshService `json:"refreshService,omitempty"` + RefreshService *RefreshService `json:"refreshService"` SchemaHash string `json:"schemaHash"` SchemaType string `json:"schemaType"` SchemaUrl string `json:"schemaUrl"` diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 6d7a48469..fcd991bf6 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -126,7 +126,7 @@ export async function getCredentials({ } export type CreateCredential = { - credentialRefreshService: { + refreshService: { id: string; type: "Iden3RefreshService2023"; } | null; @@ -351,7 +351,7 @@ export async function deleteLink({ export type CreateLink = { credentialExpiration: string | null; - credentialRefreshService: string | null; + refreshService: string | null; credentialSubject: Json; expiration: string | null; limitedClaims: number | null; diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 0f00a34f9..7ac23ce67 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -338,7 +338,7 @@ export function serializeCredentialLinkIssuance({ credentialExpiration: credentialExpiration ? serializeDate(credentialExpiration, "date") : null, - credentialRefreshService: credentialRefreshService, + refreshService: credentialRefreshService, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: linkAccessibleUntil ? linkAccessibleUntil.toISOString() : null, limitedClaims: linkMaximumIssuance ?? null, @@ -352,7 +352,7 @@ export function serializeCredentialLinkIssuance({ return serializedSchemaForm; } } - +// TODO: Check that expiration is set when refresh service is set export function serializeCredentialIssuance({ attribute, credentialSchema, @@ -381,7 +381,7 @@ export function serializeCredentialIssuance({ if (serializedSchemaForm.success) { return { data: { - credentialRefreshService: credentialRefreshService + refreshService: credentialRefreshService ? { id: credentialRefreshService, type: "Iden3RefreshService2023", From 86112622c6ae30e2b532e39da86d02988dbe8fff Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 18 Jan 2024 12:49:38 +0100 Subject: [PATCH 028/110] feat: Show refresh service in credential detail screen --- ui/src/adapters/api/credentials.ts | 1 + ui/src/components/credentials/CredentialDetails.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index fcd991bf6..108bf84f8 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -40,6 +40,7 @@ export const credentialParser = getStrictParser()( z.object({ createdAt: datetimeParser, credentialSubject: z.record(z.unknown()), + refreshService: z.object({ id: z.string(), type: z.literal("Iden3RefreshService2023") }).nullable(), expired: z.boolean(), expiresAt: datetimeParser.nullable(), id: z.string(), diff --git a/ui/src/components/credentials/CredentialDetails.tsx b/ui/src/components/credentials/CredentialDetails.tsx index b9654dec0..377c9ceae 100644 --- a/ui/src/components/credentials/CredentialDetails.tsx +++ b/ui/src/components/credentials/CredentialDetails.tsx @@ -168,7 +168,7 @@ export function CredentialDetails() { ); } else { - const { createdAt, expiresAt, proofTypes, revoked, schemaHash, schemaType, userID } = + const { refreshService, createdAt, expiresAt, proofTypes, revoked, schemaHash, schemaType, userID } = credential.data; return ( @@ -216,6 +216,11 @@ export function CredentialDetails() { text={expiresAt ? formatDate(expiresAt) : "-"} /> + + Date: Thu, 18 Jan 2024 13:20:53 +0100 Subject: [PATCH 029/110] fix: Parsing response from get credentials endpoint --- ui/src/adapters/api/credentials.ts | 12 ++++++------ ui/src/adapters/parsers/forms.ts | 14 +++++++------- .../components/credentials/CredentialDetails.tsx | 2 +- ui/src/domain/credential.ts | 6 ++++++ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 108bf84f8..4ed0b8cab 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -40,11 +40,11 @@ export const credentialParser = getStrictParser()( z.object({ createdAt: datetimeParser, credentialSubject: z.record(z.unknown()), - refreshService: z.object({ id: z.string(), type: z.literal("Iden3RefreshService2023") }).nullable(), expired: z.boolean(), expiresAt: datetimeParser.nullable(), id: z.string(), proofTypes: proofTypeParser, + refreshService: z.object({ id: z.string(), type: z.string() }).nullable(), revNonce: z.number(), revoked: z.boolean(), schemaHash: z.string(), @@ -127,14 +127,14 @@ export async function getCredentials({ } export type CreateCredential = { - refreshService: { - id: string; - type: "Iden3RefreshService2023"; - } | null; credentialSchema: string; credentialSubject: Json; expiration: string | null; mtProof: boolean; + refreshService: { + id: string; + type: "Iden3RefreshService2023"; + } | null; signatureProof: boolean; type: string; }; @@ -352,11 +352,11 @@ export async function deleteLink({ export type CreateLink = { credentialExpiration: string | null; - refreshService: string | null; credentialSubject: Json; expiration: string | null; limitedClaims: number | null; mtProof: boolean; + refreshService: string | null; schemaID: string; signatureProof: boolean; }; diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 7ac23ce67..168cbfd3a 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -338,11 +338,11 @@ export function serializeCredentialLinkIssuance({ credentialExpiration: credentialExpiration ? serializeDate(credentialExpiration, "date") : null, - refreshService: credentialRefreshService, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: linkAccessibleUntil ? linkAccessibleUntil.toISOString() : null, limitedClaims: linkMaximumIssuance ?? null, mtProof, + refreshService: credentialRefreshService, schemaID, signatureProof, }, @@ -381,16 +381,16 @@ export function serializeCredentialIssuance({ if (serializedSchemaForm.success) { return { data: { - refreshService: credentialRefreshService - ? { - id: credentialRefreshService, - type: "Iden3RefreshService2023", - } - : null, credentialSchema, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: credentialExpiration ? dayjs(credentialExpiration).toISOString() : null, mtProof, + refreshService: credentialRefreshService + ? { + id: credentialRefreshService, + type: "Iden3RefreshService2023", + } + : null, signatureProof, type, }, diff --git a/ui/src/components/credentials/CredentialDetails.tsx b/ui/src/components/credentials/CredentialDetails.tsx index 377c9ceae..a3c9e11b7 100644 --- a/ui/src/components/credentials/CredentialDetails.tsx +++ b/ui/src/components/credentials/CredentialDetails.tsx @@ -168,7 +168,7 @@ export function CredentialDetails() { ); } else { - const { refreshService, createdAt, expiresAt, proofTypes, revoked, schemaHash, schemaType, userID } = + const { createdAt, expiresAt, proofTypes, refreshService, revoked, schemaHash, schemaType, userID } = credential.data; return ( diff --git a/ui/src/domain/credential.ts b/ui/src/domain/credential.ts index 090b58a88..d3a666ade 100644 --- a/ui/src/domain/credential.ts +++ b/ui/src/domain/credential.ts @@ -2,6 +2,11 @@ export type CredentialsTabIDs = "issued" | "links"; export type ProofType = "MTP" | "SIG"; +export type RefreshService = { + id: string; + type: string; +}; + export type Credential = { createdAt: Date; credentialSubject: Record; @@ -9,6 +14,7 @@ export type Credential = { expiresAt: Date | null; id: string; proofTypes: ProofType[]; + refreshService: RefreshService | null; revNonce: number; revoked: boolean; schemaHash: string; From 99b4cca2a11f3b5537c30496026f394ba1830791 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 18 Jan 2024 13:47:52 +0100 Subject: [PATCH 030/110] feat: Credential expiration is mandatory when creating a credential with refresh service --- ui/src/adapters/parsers/forms.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 168cbfd3a..641acf88f 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -162,6 +162,14 @@ export const credentialFormParser = getStrictParser< issueCredential; const { type } = issuanceMethod; + if (refreshService.enabled && credentialExpiration === undefined) { + context.addIssue({ + code: z.ZodIssueCode.custom, + fatal: true, + message: `Credential expiration must set when refresh service is enabled.`, + }); + } + const baseIssuance = { credentialExpiration: credentialExpiration ? credentialExpiration.toDate() : undefined, credentialRefreshService: refreshService.enabled ? refreshService.url : null, From 566978b3ff10db83b4c2c11df2f11f788a292fbc Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 18 Jan 2024 13:51:08 +0100 Subject: [PATCH 031/110] chore: Remove TODO --- ui/src/adapters/parsers/forms.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 641acf88f..5d436e504 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -360,7 +360,7 @@ export function serializeCredentialLinkIssuance({ return serializedSchemaForm; } } -// TODO: Check that expiration is set when refresh service is set + export function serializeCredentialIssuance({ attribute, credentialSchema, From 6c68c029ca24ec9a84f3c1b6fd76b7c891034151 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 18 Jan 2024 16:41:20 +0100 Subject: [PATCH 032/110] fix: Create link request --- ui/src/adapters/api/credentials.ts | 5 ++++- ui/src/adapters/parsers/forms.ts | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 4ed0b8cab..f69408cac 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -356,7 +356,10 @@ export type CreateLink = { expiration: string | null; limitedClaims: number | null; mtProof: boolean; - refreshService: string | null; + refreshService: { + id: string; + type: "Iden3RefreshService2023"; + } | null; schemaID: string; signatureProof: boolean; }; diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 5d436e504..5e1071981 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -136,7 +136,11 @@ const issueCredentialFormDataParser = getStrictParser() }), z.object({ enabled: z.literal(true), - url: z.string().url() + url: z.string().url({ + code: z.ZodIssueCode.custom, + fatal: true, + message: `Refresh service URL must be a valid URL.`, + }) }), ]), schemaID: z.string().optional(), @@ -350,7 +354,12 @@ export function serializeCredentialLinkIssuance({ expiration: linkAccessibleUntil ? linkAccessibleUntil.toISOString() : null, limitedClaims: linkMaximumIssuance ?? null, mtProof, - refreshService: credentialRefreshService, + refreshService: credentialRefreshService + ? { + id: credentialRefreshService, + type: "Iden3RefreshService2023", + } + : null, schemaID, signatureProof, }, From 5d0c53511d750048658ffe87629d878b93a2747c Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Thu, 18 Jan 2024 17:46:57 +0100 Subject: [PATCH 033/110] Rename Meta as ResourceMeta --- ui/src/adapters/parsers/index.ts | 9 ++++++--- ui/src/utils/types.ts | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ui/src/adapters/parsers/index.ts b/ui/src/adapters/parsers/index.ts index f4645ee84..35592d073 100644 --- a/ui/src/adapters/parsers/index.ts +++ b/ui/src/adapters/parsers/index.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { List, Meta } from "src/utils/types"; +import { List, ResourceMeta } from "src/utils/types"; export function getListParser( parser: z.ZodSchema @@ -35,7 +35,7 @@ export function getListParser( ); } -const metaParser = getStrictParser()( +const metaParser = getStrictParser()( z.object({ max_results: z.number().int().min(1), page: z.number().int().min(1), @@ -46,7 +46,10 @@ const metaParser = getStrictParser()( export function getResourceParser( parser: z.ZodSchema ) { - return getStrictParser<{ items: unknown[]; meta: Meta }, { items: List; meta: Meta }>()( + return getStrictParser< + { items: unknown[]; meta: ResourceMeta }, + { items: List; meta: ResourceMeta } + >()( z.object({ items: getListParser(parser), meta: metaParser, diff --git a/ui/src/utils/types.ts b/ui/src/utils/types.ts index dcd2e2b17..5a1cac2bf 100644 --- a/ui/src/utils/types.ts +++ b/ui/src/utils/types.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -export type Meta = { +export type ResourceMeta = { max_results: number; page: number; total: number; @@ -13,7 +13,7 @@ export type List = { export type Resource = { items: List; - meta: Meta; + meta: ResourceMeta; }; export type Nullable = T | null | undefined; From debdc3aac85516c4d2cb5cc2992f734e7e0851b1 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Thu, 18 Jan 2024 18:17:17 +0100 Subject: [PATCH 034/110] Rename max_results as maxResults --- ui/src/adapters/api/credentials.ts | 6 +++--- ui/src/components/credentials/CredentialsTable.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 786565b95..147bfa064 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -91,13 +91,13 @@ export async function getCredential({ export async function getCredentials({ env, - params: { did, max_results, page, query, status }, + params: { did, maxResults, page, query, status }, signal, }: { env: Env; params: { did?: string; - max_results?: number; + maxResults?: number; page?: number; query?: string; status?: CredentialStatus; @@ -115,7 +115,7 @@ export async function getCredentials({ ...(did !== undefined ? { did } : {}), ...(query !== undefined ? { [QUERY_SEARCH_PARAM]: query } : {}), ...(status !== undefined && status !== "all" ? { [STATUS_SEARCH_PARAM]: status } : {}), - ...(max_results !== undefined ? { max_results: max_results.toString() } : {}), + ...(maxResults !== undefined ? { max_results: maxResults.toString() } : {}), ...(page !== undefined ? { page: page.toString() } : {}), }), signal, diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index dcbd9dbf6..b4b3cb7d1 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -233,7 +233,7 @@ export function CredentialsTable() { const response = await getCredentials({ env, params: { - max_results: paginationMaxResults, + maxResults: paginationMaxResults, page: paginationPage, query: queryParam || undefined, status: credentialStatus, From f211ed59e6d0a950e838276a0d7bbcdc9c261a32 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Thu, 18 Jan 2024 18:21:42 +0100 Subject: [PATCH 035/110] Avoid sorting credentials --- ui/src/adapters/api/credentials.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 147bfa064..d5ee10063 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -126,7 +126,7 @@ export async function getCredentials({ .transform(({ items: { failed, successful }, meta }) => ({ items: { failed, - successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), + successful, }, meta, })) From f1d74a0dc292edf5f61bd3a6d2aa7ddfc8abe5a0 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 09:58:07 +0100 Subject: [PATCH 036/110] feat: In create credential dialog: moving refresh service input field near expiration date and rewording --- ui/src/adapters/parsers/forms.ts | 2 - .../credentials/IssueCredentialForm.tsx | 48 ++++++++++--------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 5e1071981..e9ec7f23f 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -137,8 +137,6 @@ const issueCredentialFormDataParser = getStrictParser() z.object({ enabled: z.literal(true), url: z.string().url({ - code: z.ZodIssueCode.custom, - fatal: true, message: `Refresh service URL must be a valid URL.`, }) }), diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 399fbfa4d..d21b78f62 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -414,29 +414,6 @@ export function IssueCredentialForm({ inputErrors={inputErrors} /> - - - { - setRefreshServiceChecked(!refreshServiceChecked); - }} - > - Enable Credential Refresh Service - - - - - - - + + + + { + setRefreshServiceChecked(!refreshServiceChecked); + }} + > + Enable + + + + + + + + From 91a61751898ea020ab6fb4a34b442034f9fc54d0 Mon Sep 17 00:00:00 2001 From: Javi Date: Fri, 19 Jan 2024 10:42:12 +0100 Subject: [PATCH 037/110] feat: adding revoke push notification (#594) --- cmd/notifications/main.go | 1 + internal/core/event/event.go | 16 +++++ internal/core/ports/claims_repository.go | 1 + internal/core/ports/claims_service.go | 1 + internal/core/ports/notification_service.go | 1 + internal/core/services/claims.go | 5 ++ internal/core/services/notification.go | 73 +++++++++++++++++++++ internal/gateways/publisher.go | 4 ++ internal/repositories/claims.go | 40 +++++++++++ pkg/notifications/messages.go | 18 +++++ 10 files changed, 160 insertions(+) diff --git a/cmd/notifications/main.go b/cmd/notifications/main.go index d58b47932..9dd947b74 100644 --- a/cmd/notifications/main.go +++ b/cmd/notifications/main.go @@ -115,6 +115,7 @@ func main() { ps.Subscribe(ctxCancel, event.CreateCredentialEvent, notificationService.SendCreateCredentialNotification) ps.Subscribe(ctxCancel, event.CreateConnectionEvent, notificationService.SendCreateConnectionNotification) + ps.Subscribe(ctxCancel, event.CreateStateEvent, notificationService.SendRevokeCredentialNotification) gracefulShutdown := make(chan os.Signal, 1) signal.Notify(gracefulShutdown, syscall.SIGINT, syscall.SIGTERM) diff --git a/internal/core/event/event.go b/internal/core/event/event.go index 30225d5ca..fa9a91c06 100644 --- a/internal/core/event/event.go +++ b/internal/core/event/event.go @@ -9,8 +9,24 @@ import ( const ( CreateCredentialEvent = "createCredentialEvent" // CreateCredentialEvent create credential event CreateConnectionEvent = "createConnectionEvent" // CreateConnectionEvent create connection MyEvent + CreateStateEvent = "createStateEvent" // CreateStateEvent create state event ) +// CreateState defines the createState data +type CreateState struct { + State string `json:"state"` +} + +// Marshal marshals the event into a pubsub.Message +func (ev *CreateState) Marshal() (msg pubsub.Message, err error) { + return json.Marshal(ev) +} + +// Unmarshal creates an event from that message +func (ev *CreateState) Unmarshal(msg pubsub.Message) error { + return json.Unmarshal(msg, &ev) +} + // CreateCredential defines the createCredential data type CreateCredential struct { CredentialIDs []string `json:"credentialsID"` diff --git a/internal/core/ports/claims_repository.go b/internal/core/ports/claims_repository.go index 3cd0d9bcc..7e4ca1f99 100644 --- a/internal/core/ports/claims_repository.go +++ b/internal/core/ports/claims_repository.go @@ -14,6 +14,7 @@ import ( // ClaimsRepository is the interface that defines the available methods type ClaimsRepository interface { Save(ctx context.Context, conn db.Querier, claim *domain.Claim) (uuid.UUID, error) + GetRevoked(ctx context.Context, conn db.Querier, currentState string) ([]*domain.Claim, error) Revoke(ctx context.Context, conn db.Querier, revocation *domain.Revocation) error RevokeNonce(ctx context.Context, conn db.Querier, revocation *domain.Revocation) error GetByRevocationNonce(ctx context.Context, conn db.Querier, identifier *w3c.DID, revocationNonce domain.RevNonceUint64) ([]*domain.Claim, error) diff --git a/internal/core/ports/claims_service.go b/internal/core/ports/claims_service.go index d54e425ff..0b6082422 100644 --- a/internal/core/ports/claims_service.go +++ b/internal/core/ports/claims_service.go @@ -207,6 +207,7 @@ type GetCredentialQrCodeResponse struct { // ClaimsService is the interface implemented by the claim service type ClaimsService interface { Save(ctx context.Context, claimReq *CreateClaimRequest) (*domain.Claim, error) + GetRevoked(ctx context.Context, currentState string) ([]*domain.Claim, error) CreateCredential(ctx context.Context, req *CreateClaimRequest) (*domain.Claim, error) Revoke(ctx context.Context, id w3c.DID, nonce uint64, description string) error GetAll(ctx context.Context, did w3c.DID, filter *ClaimsFilter) ([]*domain.Claim, uint, error) diff --git a/internal/core/ports/notification_service.go b/internal/core/ports/notification_service.go index f4da905d9..b96e5fd11 100644 --- a/internal/core/ports/notification_service.go +++ b/internal/core/ports/notification_service.go @@ -14,6 +14,7 @@ import ( type NotificationService interface { SendCreateCredentialNotification(ctx context.Context, payload pubsub.Message) error SendCreateConnectionNotification(ctx context.Context, payload pubsub.Message) error + SendRevokeCredentialNotification(ctx context.Context, payload pubsub.Message) error } // NotificationGateway represents the notification interface diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 1511d1ad7..98779ad93 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -108,6 +108,11 @@ func (c *claim) Save(ctx context.Context, req *ports.CreateClaimRequest) (*domai return claim, nil } +// GetRevoked returns all the revoked credentials for the given state +func (c *claim) GetRevoked(ctx context.Context, currentState string) ([]*domain.Claim, error) { + return c.icRepo.GetRevoked(ctx, c.storage.Pgx, currentState) +} + // CreateCredential - Create a new Credential, but this method doesn't save it in the repository. func (c *claim) CreateCredential(ctx context.Context, req *ports.CreateClaimRequest) (*domain.Claim, error) { if err := c.guardCreateClaimRequest(req); err != nil { diff --git a/internal/core/services/notification.go b/internal/core/services/notification.go index f493a9a1f..0b7318387 100644 --- a/internal/core/services/notification.go +++ b/internal/core/services/notification.go @@ -42,6 +42,15 @@ func (n *notification) SendCreateCredentialNotification(ctx context.Context, e p return n.sendCreateCredentialNotification(ctx, cEvent.IssuerID, cEvent.CredentialIDs) } +func (n *notification) SendRevokeCredentialNotification(ctx context.Context, payload pubsub.Message) error { + var rEvent event.CreateState + if err := rEvent.Unmarshal(payload); err != nil { + return errors.New("sendRevokeCredentialNotification unexpected data type") + } + + return n.sendRevokeCredentialNotification(ctx, rEvent.State) +} + func (n *notification) SendCreateConnectionNotification(ctx context.Context, e pubsub.Message) error { var cEvent event.CreateConnection if err := cEvent.Unmarshal(e); err != nil { @@ -51,6 +60,50 @@ func (n *notification) SendCreateConnectionNotification(ctx context.Context, e p return n.sendCreateConnectionNotification(ctx, cEvent.IssuerID, cEvent.ConnectionID) } +func (n *notification) sendRevokeCredentialNotification(ctx context.Context, state string) error { + rCreds, err := n.credService.GetRevoked(ctx, state) + if err != nil { + log.Error(ctx, "sendRevokeCredentialNotification: get revoked credentials", "err", err.Error(), "state", state) + return err + } + + for _, rCred := range rCreds { + issuerDID, err := w3c.ParseDID(rCred.Issuer) + if err != nil { + log.Error(ctx, "sendRevokeCredentialNotification: failed to parse issuerID", "err", err.Error(), "issuerID", rCred.Issuer, "credID", rCred.ID) + return err + } + + userDID, err := w3c.ParseDID(rCred.OtherIdentifier) + if err != nil { + log.Error(ctx, "sendRevokeCredentialNotification: failed to parse credential userID", "err", err.Error(), "issuerID", rCred.Issuer, "credID", rCred.ID) + return err + } + + connection, err := n.connService.GetByUserID(ctx, *issuerDID, *userDID) + if err != nil { + log.Warn(ctx, "sendRevokeCredentialNotification: get connection", "err", err.Error(), "issuerID", rCred.Issuer, "credID", rCred.ID) + return err + } + + credOfferBytes, subjectDIDDoc, err := getRevokedCredentialData(connection, rCred) + if err != nil { + log.Error(ctx, "sendRevokeCredentialNotification: getCredentialOfferData", "err", err.Error(), "issuerID", rCred.Issuer, "credID", rCred.ID) + return err + } + + // send notification + log.Info(ctx, "sendRevokeCredentialNotification: sending notification", "issuerID", rCred.Issuer, "subjectDIDDoc", subjectDIDDoc.ID) + err = n.send(ctx, credOfferBytes, subjectDIDDoc) + if err != nil { + log.Error(ctx, "sendRevokeCredentialNotification: send notification", "err", err.Error(), "issuerID", rCred.Issuer, "credID", rCred.ID) + return err + } + } + + return nil +} + func (n *notification) sendCreateCredentialNotification(ctx context.Context, issuerID string, credIDs []string) error { issuerDID, err := w3c.ParseDID(issuerID) if err != nil { @@ -183,3 +236,23 @@ func getCredentialOfferData(conn *domain.Connection, credentials ...*domain.Clai return } + +func getRevokedCredentialData(conn *domain.Connection, credential *domain.Claim) (credOfferBytes []byte, subjectDIDDoc verifiable.DIDDocument, err error) { + var managedDIDDoc verifiable.DIDDocument + err = json.Unmarshal(conn.IssuerDoc, &managedDIDDoc) + if err != nil { + return nil, verifiable.DIDDocument{}, fmt.Errorf("unmarshal managedDIDDoc, err: %v", err.Error()) + } + + credOfferBytes, err = notifications.NewRevokedMsg(credential) + if err != nil { + return nil, verifiable.DIDDocument{}, fmt.Errorf("NewRevokedMsg, err: %v", err.Error()) + } + + err = json.Unmarshal(conn.UserDoc, &subjectDIDDoc) + if err != nil { + return nil, verifiable.DIDDocument{}, fmt.Errorf("unmarshal subjectDIDDoc, err: %v", err.Error()) + } + + return +} diff --git a/internal/gateways/publisher.go b/internal/gateways/publisher.go index d9585781a..0ecdc0dc4 100644 --- a/internal/gateways/publisher.go +++ b/internal/gateways/publisher.go @@ -146,6 +146,10 @@ func (p *publisher) publishState(ctx context.Context, identifier *w3c.DID) (*dom return nil, err } + if err = p.notificationPublisher.Publish(ctx, event.CreateStateEvent, &event.CreateState{State: *updatedState.State}); err != nil { + log.Error(ctx, "publish EventCreateState", "err", err.Error(), "state", *updatedState.State) + } + return &domain.PublishedState{ TxID: txID, ClaimsTreeRoot: updatedState.ClaimsTreeRoot, diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index cbfa95eda..90b075805 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -65,6 +65,46 @@ func NewClaims() ports.ClaimsRepository { return &claims{} } +// GetRevoked returns all the revoked claims from the given state +func (c *claims) GetRevoked(ctx context.Context, conn db.Querier, currentState string) ([]*domain.Claim, error) { + query := `SELECT claims.id, + issuer, + schema_hash, + schema_url, + schema_type, + other_identifier, + expiration, + updatable, + claims.version, + rev_nonce, + signature_proof, + mtp_proof, + data, + claims.identifier, + identity_state, + claims.metadata, + credential_status, + core_claim, + revoked, + mtp, + claims.created_at + FROM claims + LEFT JOIN revocation ON claims.rev_nonce = revocation.nonce AND claims.issuer = revocation.identifier + WHERE claims.identity_state = $1` + + rows, err := conn.Query(ctx, query, currentState) + if err != nil { + return nil, err + } + + claims, err := processClaims(rows) + if err != nil { + return nil, err + } + + return claims, nil +} + func (c *claims) Save(ctx context.Context, conn db.Querier, claim *domain.Claim) (uuid.UUID, error) { var err error id := claim.ID diff --git a/pkg/notifications/messages.go b/pkg/notifications/messages.go index 7743a2d2e..40fd98279 100644 --- a/pkg/notifications/messages.go +++ b/pkg/notifications/messages.go @@ -40,6 +40,24 @@ func NewOfferMsg(fetchURL string, credentials ...*domain.Claim) ([]byte, error) return json.Marshal(credOffer) } +// NewRevokedMsg returns a revoked message +func NewRevokedMsg(claim *domain.Claim) ([]byte, error) { + msgID := uuid.NewString() + statusUpdate := &protocol.CredentialStatusUpdateMessage{ + ID: msgID, + Typ: packers.MediaTypePlainMessage, + Type: protocol.CredentialStatusUpdateMessageType, + ThreadID: msgID, + Body: protocol.CredentialStatusUpdateMessageBody{ + ID: claim.ID.String(), + Reason: "claim was revoked", + }, + From: claim.Issuer, + To: claim.OtherIdentifier, + } + return json.Marshal(statusUpdate) +} + func toProtocolCredentialOffer(credentials []*domain.Claim) []protocol.CredentialOffer { offers := make([]protocol.CredentialOffer, len(credentials)) for i := range credentials { From bc18a58dab6f74a752f1653bdbde356c76e04000 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 11:33:48 +0100 Subject: [PATCH 038/110] chore: Revert renaming of IssuedQRCode.qrCodeLink --- ui/src/adapters/api/credentials.ts | 2 +- ui/src/components/credentials/CredentialIssuedQR.tsx | 4 ++-- ui/src/domain/credential.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index a33b0f571..a4a9619c3 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -436,7 +436,7 @@ const issuedQRCodeParser = getStrictParser()( z.object({ qrCodeLink: z.string(), schemaType: z.string(), - }).transform(({ qrCodeLink, schemaType }) => ({qrCode: qrCodeLink, schemaType})) + }) ); export async function getIssuedQRCodes({ diff --git a/ui/src/components/credentials/CredentialIssuedQR.tsx b/ui/src/components/credentials/CredentialIssuedQR.tsx index a6e4e142e..75e700fb6 100644 --- a/ui/src/components/credentials/CredentialIssuedQR.tsx +++ b/ui/src/components/credentials/CredentialIssuedQR.tsx @@ -68,8 +68,8 @@ export function CredentialIssuedQR() { const [issuedQRCodeLink, issuedQRCodeRaw] = issuedQRCodes.data; return ( diff --git a/ui/src/domain/credential.ts b/ui/src/domain/credential.ts index 77526cdfa..090b58a88 100644 --- a/ui/src/domain/credential.ts +++ b/ui/src/domain/credential.ts @@ -18,7 +18,7 @@ export type Credential = { }; export type IssuedQRCode = { - qrCode: string; + qrCodeLink: string; schemaType: string; }; From ecaa337a34dfbc97f11a490127c7c8e7b6d3b298 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 12:33:37 +0100 Subject: [PATCH 039/110] feat: Add base64 encoded type. chore: Rename QRcode field --- ui/src/adapters/api/credentials.ts | 9 ++++++-- .../credentials/CredentialIssuedQR.tsx | 5 ++-- .../credentials/CredentialLinkQR.tsx | 1 + .../components/credentials/CredentialQR.tsx | 23 +++++++++++++++---- ui/src/domain/credential.ts | 2 +- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index a4a9619c3..4a1529f80 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -432,11 +432,16 @@ export async function createAuthQRCode({ } } -const issuedQRCodeParser = getStrictParser()( +type IssuedQRCodeInput = { + qrCodeLink: string; + schemaType: string; +}; + +const issuedQRCodeParser = getStrictParser()( z.object({ qrCodeLink: z.string(), schemaType: z.string(), - }) + }).transform(({ qrCodeLink, schemaType }) => ({ qrCode: qrCodeLink, schemaType: schemaType })) ); export async function getIssuedQRCodes({ diff --git a/ui/src/components/credentials/CredentialIssuedQR.tsx b/ui/src/components/credentials/CredentialIssuedQR.tsx index 75e700fb6..bdb1777be 100644 --- a/ui/src/components/credentials/CredentialIssuedQR.tsx +++ b/ui/src/components/credentials/CredentialIssuedQR.tsx @@ -68,8 +68,9 @@ export function CredentialIssuedQR() { const [issuedQRCodeLink, issuedQRCodeRaw] = issuedQRCodes.data; return ( diff --git a/ui/src/components/credentials/CredentialLinkQR.tsx b/ui/src/components/credentials/CredentialLinkQR.tsx index 761654017..d2705a12f 100644 --- a/ui/src/components/credentials/CredentialLinkQR.tsx +++ b/ui/src/components/credentials/CredentialLinkQR.tsx @@ -239,6 +239,7 @@ export function CredentialLinkQR() { return ( ), key: "1", - label: "Raw JSON", + label: "Link", }, { children: ( @@ -41,12 +43,25 @@ export function CredentialQR({ includeMargin level="H" style={{ height: 300 }} - value={qrCodeLink} + value={qrCodeRaw} /> ), key: "2", - label: "Link", + label: "Raw JSON", }, + { + children: ( + + ), + key: "3", + label: "Base64 encoded", + } ]; return ( diff --git a/ui/src/domain/credential.ts b/ui/src/domain/credential.ts index 090b58a88..77526cdfa 100644 --- a/ui/src/domain/credential.ts +++ b/ui/src/domain/credential.ts @@ -18,7 +18,7 @@ export type Credential = { }; export type IssuedQRCode = { - qrCodeLink: string; + qrCode: string; schemaType: string; }; From 42554188491fb175de8c1da6f4c8870c354bd1b4 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 16:03:44 +0100 Subject: [PATCH 040/110] chore: no camel case in max_results --- ui/src/adapters/api/connections.ts | 6 +++--- ui/src/components/connections/ConnectionsTable.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/api/connections.ts b/ui/src/adapters/api/connections.ts index b6ebae358..d50ffaa46 100644 --- a/ui/src/adapters/api/connections.ts +++ b/ui/src/adapters/api/connections.ts @@ -57,13 +57,13 @@ export async function getConnection({ export async function getConnections({ credentials, env, - params: { max_results, page, query }, + params: { maxResults, page, query }, signal, }: { credentials: boolean; env: Env; params: { - max_results?: number; + maxResults?: number; page?: number; query?: string; }; @@ -79,7 +79,7 @@ export async function getConnections({ params: new URLSearchParams({ ...(query !== undefined ? { [QUERY_SEARCH_PARAM]: query } : {}), ...(credentials ? { credentials: "true" } : {}), - ...(max_results !== undefined ? { max_results: max_results.toString() } : {}), + ...(maxResults !== undefined ? { max_results: maxResults.toString() } : {}), ...(page !== undefined ? { page: page.toString() } : {}), }), signal, diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index 5e34e51f0..a0ce0907c 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -185,7 +185,7 @@ export function ConnectionsTable() { credentials: true, env, params: { - max_results: paginationMaxResults, + maxResults: paginationMaxResults, page: paginationPage, query: queryParam || undefined, }, From c1a996a5c7ce5d496a80e88c3ed3414e0d1743e4 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 16:07:14 +0100 Subject: [PATCH 041/110] fix: Do not sort connections view by date. --- ui/src/adapters/api/connections.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/adapters/api/connections.ts b/ui/src/adapters/api/connections.ts index d50ffaa46..8cf99faa0 100644 --- a/ui/src/adapters/api/connections.ts +++ b/ui/src/adapters/api/connections.ts @@ -90,7 +90,7 @@ export async function getConnections({ .transform(({ items: { failed, successful }, meta }) => ({ items: { failed, - successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), + successful, }, meta, })) From badbe8b13ba76c339ea3e4190f4e32ca2ff1f591 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 16:09:45 +0100 Subject: [PATCH 042/110] chore: Import with with absolute path --- ui/src/components/connections/ConnectionsTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index a0ce0907c..ea0adcb97 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -14,7 +14,7 @@ import { import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate, useSearchParams } from "react-router-dom"; -import { positiveIntegerFromStringParser } from "../../adapters/parsers"; +import { positiveIntegerFromStringParser } from "src/adapters/parsers"; import { getConnections } from "src/adapters/api/connections"; import IconCreditCardPlus from "src/assets/icons/credit-card-plus.svg?react"; import IconDots from "src/assets/icons/dots-vertical.svg?react"; From 03862f8a5670dd5573f79119bb234282a1a1a240 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 16:17:22 +0100 Subject: [PATCH 043/110] chore: Do not base64 qrcode in as it can be generated from parameter qrCodeRaw --- ui/src/components/credentials/CredentialIssuedQR.tsx | 1 - ui/src/components/credentials/CredentialLinkQR.tsx | 1 - ui/src/components/credentials/CredentialQR.tsx | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/src/components/credentials/CredentialIssuedQR.tsx b/ui/src/components/credentials/CredentialIssuedQR.tsx index bdb1777be..a6e4e142e 100644 --- a/ui/src/components/credentials/CredentialIssuedQR.tsx +++ b/ui/src/components/credentials/CredentialIssuedQR.tsx @@ -68,7 +68,6 @@ export function CredentialIssuedQR() { const [issuedQRCodeLink, issuedQRCodeRaw] = issuedQRCodes.data; return ( Date: Fri, 19 Jan 2024 16:41:18 +0100 Subject: [PATCH 044/110] chore: npm run lint:fix && npm run format --- ui/src/adapters/api/credentials.ts | 10 ++++++---- ui/src/components/connections/ConnectionsTable.tsx | 2 +- ui/src/components/credentials/CredentialQR.tsx | 4 ++-- ui/src/components/credentials/IssuanceMethodForm.tsx | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 4a1529f80..dbfae089f 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -438,10 +438,12 @@ type IssuedQRCodeInput = { }; const issuedQRCodeParser = getStrictParser()( - z.object({ - qrCodeLink: z.string(), - schemaType: z.string(), - }).transform(({ qrCodeLink, schemaType }) => ({ qrCode: qrCodeLink, schemaType: schemaType })) + z + .object({ + qrCodeLink: z.string(), + schemaType: z.string(), + }) + .transform(({ qrCodeLink, schemaType }) => ({ qrCode: qrCodeLink, schemaType: schemaType })) ); export async function getIssuedQRCodes({ diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index ea0adcb97..2507a36c9 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -14,8 +14,8 @@ import { import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate, useSearchParams } from "react-router-dom"; -import { positiveIntegerFromStringParser } from "src/adapters/parsers"; import { getConnections } from "src/adapters/api/connections"; +import { positiveIntegerFromStringParser } from "src/adapters/parsers"; import IconCreditCardPlus from "src/assets/icons/credit-card-plus.svg?react"; import IconDots from "src/assets/icons/dots-vertical.svg?react"; import IconInfoCircle from "src/assets/icons/info-circle.svg?react"; diff --git a/ui/src/components/credentials/CredentialQR.tsx b/ui/src/components/credentials/CredentialQR.tsx index 52b7dedec..7c401d14b 100644 --- a/ui/src/components/credentials/CredentialQR.tsx +++ b/ui/src/components/credentials/CredentialQR.tsx @@ -20,7 +20,7 @@ export function CredentialQR({ const { lg } = Grid.useBreakpoint(); - const qrCodeBase64=`iden3comm://?i_m=${btoa(qrCodeRaw)}` + const qrCodeBase64 = `iden3comm://?i_m=${btoa(qrCodeRaw)}`; const qrCodeTabs: TabsProps["items"] = [ { @@ -61,7 +61,7 @@ export function CredentialQR({ ), key: "3", label: "Base64 encoded", - } + }, ]; return ( diff --git a/ui/src/components/credentials/IssuanceMethodForm.tsx b/ui/src/components/credentials/IssuanceMethodForm.tsx index 3f17a28df..4ac3ab07c 100644 --- a/ui/src/components/credentials/IssuanceMethodForm.tsx +++ b/ui/src/components/credentials/IssuanceMethodForm.tsx @@ -55,7 +55,9 @@ export function IssuanceMethodForm({ const response = await getConnections({ credentials: false, env, - params: { max_results: 0 }, + params: { + maxResults: 0, + }, signal, }); From f470cc8bfc195c73dc616a66744916cbad1395af Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 18:37:46 +0100 Subject: [PATCH 045/110] feat: getConnections returns 1000 connections by default if maxResults has no value --- internal/api_ui/responses.go | 10 +++---- internal/core/ports/connections_service.go | 14 ++++------ internal/repositories/connections.go | 28 ++++++------------- .../repositories/tests/connections_test.go | 14 +++++----- pkg/pagination/pagination.go | 21 ++++++++------ .../credentials/IssuanceMethodForm.tsx | 4 +-- 6 files changed, 39 insertions(+), 52 deletions(-) diff --git a/internal/api_ui/responses.go b/internal/api_ui/responses.go index bbe2f8a1e..9effcee01 100644 --- a/internal/api_ui/responses.go +++ b/internal/api_ui/responses.go @@ -164,7 +164,7 @@ func connectionsResponse(conns []*domain.Connection) (GetConnectionsResponse, er return resp, nil } -func connectionsPaginatedResponse(conns []*domain.Connection, pagFilter *pagination.Filter, total uint) (ConnectionsPaginated, error) { +func connectionsPaginatedResponse(conns []*domain.Connection, pagFilter pagination.Filter, total uint) (ConnectionsPaginated, error) { resp, err := connectionsResponse(conns) if err != nil { return ConnectionsPaginated{}, err @@ -173,13 +173,13 @@ func connectionsPaginatedResponse(conns []*domain.Connection, pagFilter *paginat connsPag := ConnectionsPaginated{ Items: resp, Meta: PaginatedMetadata{ - Page: 1, // default - Total: total, + MaxResults: pagFilter.MaxResults, + Page: 1, // default + Total: total, }, } - if pagFilter != nil { + if pagFilter.Page != nil { connsPag.Meta.Page = *pagFilter.Page - connsPag.Meta.MaxResults = pagFilter.MaxResults } return connsPag, nil diff --git a/internal/core/ports/connections_service.go b/internal/core/ports/connections_service.go index 0a22dffbf..4f5644134 100644 --- a/internal/core/ports/connections_service.go +++ b/internal/core/ports/connections_service.go @@ -15,28 +15,24 @@ import ( type NewGetAllConnectionsRequest struct { WithCredentials bool Query string - Pagination *pagination.Filter + Pagination pagination.Filter OrderBy sqltools.OrderByFilters } // NewGetAllRequest returns the request object for obtaining all connections func NewGetAllRequest(withCredentials *bool, query *string, page *uint, maxResults *uint, orderBy sqltools.OrderByFilters) *NewGetAllConnectionsRequest { - var ( - connQuery string - pagFilter *pagination.Filter - ) + var connQuery string + if query != nil { connQuery = *query } - if page != nil { - pagFilter = pagination.NewFilter(maxResults, page) - } + pagFilter := pagination.NewFilter(maxResults, page) return &NewGetAllConnectionsRequest{ WithCredentials: withCredentials != nil && *withCredentials, Query: connQuery, - Pagination: pagFilter, + Pagination: *pagFilter, OrderBy: orderBy, } } diff --git a/internal/repositories/connections.go b/internal/repositories/connections.go index 95476da0e..670e11363 100644 --- a/internal/repositories/connections.go +++ b/internal/repositories/connections.go @@ -173,12 +173,11 @@ func (c *connections) GetAllByIssuerID(ctx context.Context, conn db.Querier, iss _ = filter.OrderBy.Add(ports.ConnectionsCreatedAt, true) countQuery := strings.Replace(all, "##QUERYFIELDS##", "COUNT(*)", 1) all += " ORDER BY " + filter.OrderBy.String() - if filter.Pagination != nil { - if err := conn.QueryRow(ctx, countQuery, issuerDID.String()).Scan(&count); err != nil { - return nil, 0, err - } - all += fmt.Sprintf(" OFFSET %d LIMIT %d;", filter.Pagination.GetOffset(), filter.Pagination.GetLimit()) + + if err := conn.QueryRow(ctx, countQuery, issuerDID.String()).Scan(&count); err != nil { + return nil, 0, err } + all += fmt.Sprintf(" OFFSET %d LIMIT %d;", filter.Pagination.GetOffset(), filter.Pagination.GetLimit()) all = strings.Replace(all, "##QUERYFIELDS##", strings.Join(fields, ","), 1) rows, err := conn.Query(ctx, all, issuerDID.String()) @@ -200,21 +199,15 @@ func (c *connections) GetAllByIssuerID(ctx context.Context, conn db.Querier, iss domainConns = append(domainConns, domainConn) } - if filter.Pagination == nil { - count = uint(len(domainConns)) - } - return domainConns, count, nil } func (c *connections) GetAllWithCredentialsByIssuerID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, filter *ports.NewGetAllConnectionsRequest) ([]*domain.Connection, uint, error) { + var count uint sqlQuery, countQuery, filters := buildGetAllWithCredentialsQueryAndFilters(issuerDID, filter) - var count uint - if filter.Pagination != nil { - if err := conn.QueryRow(ctx, countQuery, filters...).Scan(&count); err != nil { - return nil, 0, err - } + if err := conn.QueryRow(ctx, countQuery, filters...).Scan(&count); err != nil { + return nil, 0, err } rows, err := conn.Query(ctx, sqlQuery, filters...) @@ -225,9 +218,6 @@ func (c *connections) GetAllWithCredentialsByIssuerID(ctx context.Context, conn defer rows.Close() conns, err := toConnectionsWithCredentials(rows) - if filter.Pagination == nil { - count = uint(len(conns)) - } return conns, count, err } @@ -294,9 +284,7 @@ func buildGetAllWithCredentialsQueryAndFilters(issuerDID w3c.DID, filter *ports. _ = filter.OrderBy.Add(ports.ConnectionsCreatedAt, true) sqlQuery += " ORDER BY " + filter.OrderBy.String() - if filter.Pagination != nil { - sqlQuery += fmt.Sprintf(" OFFSET %d LIMIT %d;", filter.Pagination.GetOffset(), filter.Pagination.GetLimit()) - } + sqlQuery += fmt.Sprintf(" OFFSET %d LIMIT %d;", filter.Pagination.GetOffset(), filter.Pagination.GetLimit()) return sqlQuery, countQuery, sqlArgs } diff --git a/internal/repositories/tests/connections_test.go b/internal/repositories/tests/connections_test.go index 12f7f1172..6b82a5f12 100644 --- a/internal/repositories/tests/connections_test.go +++ b/internal/repositories/tests/connections_test.go @@ -170,43 +170,43 @@ func TestConnectionsGetAllByIssuerID(t *testing.T) { t.Run("should get 1 connection for a the given issuerDID and no query", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: ""}) require.NoError(t, err) - assert.Equal(t, len(conns), 1) + assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and valid query, just beginning", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:"}) require.NoError(t, err) - assert.Equal(t, len(conns), 1) + assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and valid query, full did", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAwYQzCp9VfhpNgeLtK2iCehDDrfMWUCEg5ig5"}) require.NoError(t, err) - assert.Equal(t, len(conns), 1) + assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and valid query, part of did", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAw"}) require.NoError(t, err) - assert.Equal(t, len(conns), 1) + assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and a query with some chars in the middle of a string", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "H7XAw"}) require.NoError(t, err) - assert.Equal(t, len(conns), 1) + assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and a query with some chars in the middle of a string and other words", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "H7XAw other words"}) require.NoError(t, err) - assert.Equal(t, len(conns), 1) + assert.Equal(t, 1, len(conns)) }) t.Run("should get 0 connections for a the given issuerDID and non existing userDID", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAwnonexisting"}) require.NoError(t, err) - assert.Equal(t, len(conns), 0) + assert.Equal(t, 1, len(conns)) }) } diff --git a/pkg/pagination/pagination.go b/pkg/pagination/pagination.go index 1e7557265..ad34add2c 100644 --- a/pkg/pagination/pagination.go +++ b/pkg/pagination/pagination.go @@ -1,6 +1,6 @@ package pagination -const defaultMaxResults = 50 +const defaultMaxResults = 1000 // Filter is a struct that contains the pagination filter type Filter struct { @@ -10,23 +10,28 @@ type Filter struct { // NewFilter creates a new filter func NewFilter(maxResults *uint, page *uint) *Filter { - var maxR uint = defaultMaxResults - if maxResults != nil { - maxR = *maxResults - } - - return &Filter{ - MaxResults: maxR, + f := &Filter{ + MaxResults: defaultMaxResults, Page: page, } + if maxResults != nil { + f.MaxResults = *maxResults + } + return f } // GetLimit returns the limit for the query func (f *Filter) GetLimit() uint { + if f.MaxResults == 0 { + return defaultMaxResults + } return f.MaxResults } // GetOffset returns the offset for the query func (f *Filter) GetOffset() uint { + if f.Page == nil { + return 0 + } return (*f.Page - 1) * f.MaxResults } diff --git a/ui/src/components/credentials/IssuanceMethodForm.tsx b/ui/src/components/credentials/IssuanceMethodForm.tsx index 4ac3ab07c..4ba172d73 100644 --- a/ui/src/components/credentials/IssuanceMethodForm.tsx +++ b/ui/src/components/credentials/IssuanceMethodForm.tsx @@ -55,9 +55,7 @@ export function IssuanceMethodForm({ const response = await getConnections({ credentials: false, env, - params: { - maxResults: 0, - }, + params: {}, signal, }); From e0eac05770c7b5bc968030277bc00bb4a3d434ff Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 18:41:05 +0100 Subject: [PATCH 046/110] fix: typo in test --- internal/api_ui/server_test.go | 2 +- internal/repositories/tests/connections_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index eb7eeca04..3243206e4 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -2904,7 +2904,7 @@ func TestServer_GetConnections(t *testing.T) { auth: authOk, request: GetConnectionsRequestObject{ Params: GetConnectionsParams{ - MaxResults: common.ToPointer(uint(1)), + MaxResults: common.ToPointer(uint(2)), }, }, expected: expected{ diff --git a/internal/repositories/tests/connections_test.go b/internal/repositories/tests/connections_test.go index 6b82a5f12..25745d34b 100644 --- a/internal/repositories/tests/connections_test.go +++ b/internal/repositories/tests/connections_test.go @@ -206,7 +206,7 @@ func TestConnectionsGetAllByIssuerID(t *testing.T) { t.Run("should get 0 connections for a the given issuerDID and non existing userDID", func(t *testing.T) { conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAwnonexisting"}) require.NoError(t, err) - assert.Equal(t, 1, len(conns)) + assert.Equal(t, 0, len(conns)) }) } From 02c363f399f1447962ae8ca297d6adbfd8216ccd Mon Sep 17 00:00:00 2001 From: x1m3 Date: Fri, 19 Jan 2024 18:56:01 +0100 Subject: [PATCH 047/110] chore: Remove unneded transformation --- ui/src/adapters/api/connections.ts | 12 +----------- ui/src/adapters/api/credentials.ts | 9 +-------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/ui/src/adapters/api/connections.ts b/ui/src/adapters/api/connections.ts index 8cf99faa0..e0c94b1e3 100644 --- a/ui/src/adapters/api/connections.ts +++ b/ui/src/adapters/api/connections.ts @@ -85,17 +85,7 @@ export async function getConnections({ signal, url: `${API_VERSION}/connections`, }); - return buildSuccessResponse( - getResourceParser(connectionParser) - .transform(({ items: { failed, successful }, meta }) => ({ - items: { - failed, - successful, - }, - meta, - })) - .parse(response.data) - ); + return buildSuccessResponse(getResourceParser(connectionParser).parse(response.data)); } catch (error) { return buildErrorResponse(error); } diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index dbfae089f..1f71e7e3e 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -295,14 +295,7 @@ export async function getLinks({ signal, url: `${API_VERSION}/credentials/links`, }); - return buildSuccessResponse( - getListParser(linkParser) - .transform(({ failed, successful }) => ({ - failed, - successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), - })) - .parse(response.data) - ); + return buildSuccessResponse(getListParser(linkParser).parse(response.data)); } catch (error) { return buildErrorResponse(error); } From 053e51079116d2971380aa144caa638c088c1ff6 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Mon, 22 Jan 2024 09:29:57 +0100 Subject: [PATCH 048/110] fix: Order in getLinks and getCredentials --- ui/src/adapters/api/credentials.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 1f71e7e3e..d114bdf83 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -121,17 +121,7 @@ export async function getCredentials({ signal, url: `${API_VERSION}/credentials`, }); - return buildSuccessResponse( - getResourceParser(credentialParser) - .transform(({ items: { failed, successful }, meta }) => ({ - items: { - failed, - successful, - }, - meta, - })) - .parse(response.data) - ); + return buildSuccessResponse(getResourceParser(credentialParser).parse(response.data)); } catch (error) { return buildErrorResponse(error); } @@ -295,7 +285,14 @@ export async function getLinks({ signal, url: `${API_VERSION}/credentials/links`, }); - return buildSuccessResponse(getListParser(linkParser).parse(response.data)); + return buildSuccessResponse( + getListParser(linkParser) + .transform(({ failed, successful }) => ({ + failed, + successful: successful.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()), + })) + .parse(response.data) + ); } catch (error) { return buildErrorResponse(error); } From 38fb355c9df17fef5f8e2cdc80b868776d2d61fb Mon Sep 17 00:00:00 2001 From: x1m3 Date: Mon, 22 Jan 2024 09:40:41 +0100 Subject: [PATCH 049/110] chore: KISS principle. --- internal/core/services/claims.go | 36 +++++++------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 98779ad93..0f7f25c5a 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -655,37 +655,17 @@ func (c *claim) createVC(ctx context.Context, claimReq *ports.CreateClaimRequest } func (c *claim) guardCreateClaimRequest(req *ports.CreateClaimRequest) error { - type guardFunc func() error - - guards := []guardFunc{ - // check if schema's URL is valid - func() error { - if _, err := url.ParseRequestURI(req.Schema); err != nil { - return ErrMalformedURL - } - return nil - }, - // check if refresh service has supported type - func() error { - if req.RefreshService == nil { - return nil - } - if req.Expiration == nil { - return ErrRefreshServiceLacksExpirationTime - } - if req.RefreshService.Type != verifiable.Iden3RefreshService2023 { - return ErrUnsupportedRefreshServiceType - } - return nil - }, + if _, err := url.ParseRequestURI(req.Schema); err != nil { + return ErrMalformedURL } - - for _, guard := range guards { - if err := guard(); err != nil { - return err + if req.RefreshService != nil { + if req.Expiration == nil { + return ErrRefreshServiceLacksExpirationTime + } + if req.RefreshService.Type != verifiable.Iden3RefreshService2023 { + return ErrUnsupportedRefreshServiceType } } - return nil } From 137a577b57ad83d99b9dad5cd3656376a709dcc9 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Mon, 22 Jan 2024 12:06:04 -0300 Subject: [PATCH 050/110] chore: add health check endpoint --- cmd/notifications/main.go | 19 +++++++++++++++++-- cmd/pending_publisher/main.go | 15 +++++++++++++++ infrastructure/local/docker-compose.yml | 4 ++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/cmd/notifications/main.go b/cmd/notifications/main.go index 9dd947b74..46aa676bb 100644 --- a/cmd/notifications/main.go +++ b/cmd/notifications/main.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "math/big" + "net/http" "os" "os/signal" "syscall" @@ -28,7 +29,7 @@ import ( "github.com/polygonid/sh-id-platform/pkg/blockchain/eth" "github.com/polygonid/sh-id-platform/pkg/cache" "github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status" - "github.com/polygonid/sh-id-platform/pkg/http" + httpPkg "github.com/polygonid/sh-id-platform/pkg/http" "github.com/polygonid/sh-id-platform/pkg/pubsub" "github.com/polygonid/sh-id-platform/pkg/reverse_hash" ) @@ -102,7 +103,7 @@ func main() { return } - notificationGateway := gateways.NewPushNotificationClient(http.DefaultHTTPClientWithRetry) + notificationGateway := gateways.NewPushNotificationClient(httpPkg.DefaultHTTPClientWithRetry) notificationService := services.NewNotification(notificationGateway, connectionsService, credentialsService) ctxCancel, cancel := context.WithCancel(ctx) defer func() { @@ -120,6 +121,20 @@ func main() { gracefulShutdown := make(chan os.Signal, 1) signal.Notify(gracefulShutdown, syscall.SIGINT, syscall.SIGTERM) + go func() { + http.Handle("/status", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + _, err := w.Write([]byte("OK")) + if err != nil { + log.Error(ctx, "error writing response", "err", err) + } + })) + log.Info(ctx, "Starting server at port 3004") + err := http.ListenAndServe(":3004", nil) + if err != nil { + log.Error(ctx, "error starting server", "err", err) + } + }() + <-gracefulShutdown } diff --git a/cmd/pending_publisher/main.go b/cmd/pending_publisher/main.go index 40dba78d1..fb9e8c29b 100644 --- a/cmd/pending_publisher/main.go +++ b/cmd/pending_publisher/main.go @@ -3,6 +3,7 @@ package main import ( "context" "math/big" + "net/http" "os" "os/signal" "syscall" @@ -190,6 +191,20 @@ func main() { } }(ctx) + go func() { + http.Handle("/status", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + _, err := w.Write([]byte("OK")) + if err != nil { + log.Error(ctx, "error writing response", "err", err) + } + })) + log.Info(ctx, "Starting server at port 3005") + err := http.ListenAndServe(":3005", nil) + if err != nil { + log.Error(ctx, "error starting server", "err", err) + } + }() + <-quit log.Info(ctx, "finishing app") cancel() diff --git a/infrastructure/local/docker-compose.yml b/infrastructure/local/docker-compose.yml index f370b2e8c..569934c81 100644 --- a/infrastructure/local/docker-compose.yml +++ b/infrastructure/local/docker-compose.yml @@ -52,6 +52,8 @@ services: build: context: ../../ dockerfile: ${DOCKER_FILE} + ports: + - "3004:3004" env_file: - ../../.env-api - ../../.env-issuer @@ -61,6 +63,8 @@ services: build: context: ../../ dockerfile: ${DOCKER_FILE} + ports: + - "3005:3005" env_file: - ../../.env-api - ../../.env-issuer From 32b019c8062f6e494a923baf68d665335955b746 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Mon, 22 Jan 2024 18:41:56 +0100 Subject: [PATCH 051/110] feat: API access credential expiration time as a datetime and not a date. Credential object always return refresh Service field --- api_ui/api.yaml | 5 +++-- internal/api_ui/api.gen.go | 19 +++++++++---------- internal/api_ui/server.go | 7 +------ internal/api_ui/server_test.go | 13 ++++++------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/api_ui/api.yaml b/api_ui/api.yaml index 6d7acaf36..ef04e7884 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -1518,6 +1518,7 @@ components: # refresh service RefreshService: type: object + x-omitempty: false required: - id - type @@ -1656,8 +1657,8 @@ components: x-omitempty: false credentialExpiration: type: string - format: date - example: "2022-12-20" + format: date-time + example: 2025-04-17T11:40:43.681857-03:00 expiration: type: string format: date-time diff --git a/internal/api_ui/api.gen.go b/internal/api_ui/api.gen.go index d184fecef..50c9a9c5e 100644 --- a/internal/api_ui/api.gen.go +++ b/internal/api_ui/api.gen.go @@ -15,7 +15,6 @@ import ( uuid "github.com/google/uuid" "github.com/oapi-codegen/runtime" strictnethttp "github.com/oapi-codegen/runtime/strictmiddleware/nethttp" - openapi_types "github.com/oapi-codegen/runtime/types" timeapi "github.com/polygonid/sh-id-platform/internal/timeapi" ) @@ -131,21 +130,21 @@ type CreateCredentialRequest struct { CredentialSubject map[string]interface{} `json:"credentialSubject"` Expiration *time.Time `json:"expiration,omitempty"` MtProof *bool `json:"mtProof,omitempty"` - RefreshService *RefreshService `json:"refreshService,omitempty"` + RefreshService *RefreshService `json:"refreshService"` SignatureProof *bool `json:"signatureProof,omitempty"` Type string `json:"type"` } // CreateLinkRequest defines model for CreateLinkRequest. type CreateLinkRequest struct { - CredentialExpiration *openapi_types.Date `json:"credentialExpiration,omitempty"` - CredentialSubject CredentialSubject `json:"credentialSubject"` - Expiration *time.Time `json:"expiration,omitempty"` - LimitedClaims *int `json:"limitedClaims"` - MtProof bool `json:"mtProof"` - RefreshService *RefreshService `json:"refreshService,omitempty"` - SchemaID uuid.UUID `json:"schemaID"` - SignatureProof bool `json:"signatureProof"` + CredentialExpiration *time.Time `json:"credentialExpiration,omitempty"` + CredentialSubject CredentialSubject `json:"credentialSubject"` + Expiration *time.Time `json:"expiration,omitempty"` + LimitedClaims *int `json:"limitedClaims"` + MtProof bool `json:"mtProof"` + RefreshService *RefreshService `json:"refreshService"` + SchemaID uuid.UUID `json:"schemaID"` + SignatureProof bool `json:"signatureProof"` } // Credential defines model for Credential. diff --git a/internal/api_ui/server.go b/internal/api_ui/server.go index 335096fec..62763828c 100644 --- a/internal/api_ui/server.go +++ b/internal/api_ui/server.go @@ -504,12 +504,7 @@ func (s *Server) CreateLink(ctx context.Context, request CreateLinkRequestObject } } - var expirationDate *time.Time - if request.Body.CredentialExpiration != nil { - expirationDate = &request.Body.CredentialExpiration.Time - } - - createdLink, err := s.linkService.Save(ctx, s.cfg.APIUI.IssuerDID, request.Body.LimitedClaims, request.Body.Expiration, request.Body.SchemaID, expirationDate, request.Body.SignatureProof, request.Body.MtProof, credSubject, toVerifiableRefreshService(request.Body.RefreshService)) + createdLink, err := s.linkService.Save(ctx, s.cfg.APIUI.IssuerDID, request.Body.LimitedClaims, request.Body.Expiration, request.Body.SchemaID, request.Body.CredentialExpiration, request.Body.SignatureProof, request.Body.MtProof, credSubject, toVerifiableRefreshService(request.Body.RefreshService)) if err != nil { log.Error(ctx, "error saving the link", "err", err.Error()) if errors.Is(err, services.ErrLoadingSchema) { diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 9b197605b..27e2c6713 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -20,7 +20,6 @@ import ( "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/iden3/iden3comm/v2/protocol" "github.com/mitchellh/mapstructure" - "github.com/oapi-codegen/runtime/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -3307,7 +3306,7 @@ func TestServer_CreateLink(t *testing.T) { body: CreateLinkRequest{ SchemaID: importedSchema.ID, Expiration: common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)), - CredentialExpiration: &types.Date{Time: time.Date(2023, 8, 15, 14, 30, 45, 100, time.Local)}, + CredentialExpiration: common.ToPointer(time.Date(2023, 8, 15, 14, 30, 45, 100, time.Local)), LimitedClaims: common.ToPointer(10), CredentialSubject: CredentialSubject{"birthday": 19790911, "documentType": 12}, MtProof: true, @@ -3324,7 +3323,7 @@ func TestServer_CreateLink(t *testing.T) { body: CreateLinkRequest{ SchemaID: importedSchema.ID, Expiration: common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)), - CredentialExpiration: &types.Date{Time: time.Date(2023, 8, 15, 14, 30, 45, 100, time.Local)}, + CredentialExpiration: common.ToPointer(time.Date(2023, 8, 15, 14, 30, 45, 100, time.Local)), LimitedClaims: common.ToPointer(10), CredentialSubject: CredentialSubject{"birthday": 19790911, "documentType": 12}, MtProof: false, @@ -3341,7 +3340,7 @@ func TestServer_CreateLink(t *testing.T) { body: CreateLinkRequest{ SchemaID: importedSchema.ID, Expiration: common.ToPointer(time.Date(2000, 8, 15, 14, 30, 45, 100, time.Local)), - CredentialExpiration: &types.Date{Time: time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)}, + CredentialExpiration: common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)), LimitedClaims: common.ToPointer(10), CredentialSubject: CredentialSubject{"birthday": 19790911, "documentType": 12}, MtProof: true, @@ -3392,7 +3391,7 @@ func TestServer_CreateLink(t *testing.T) { body: CreateLinkRequest{ SchemaID: importedSchema.ID, Expiration: common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)), - CredentialExpiration: &types.Date{Time: time.Date(2000, 8, 15, 14, 30, 45, 100, time.Local)}, + CredentialExpiration: common.ToPointer(time.Date(2020, 8, 15, 14, 30, 45, 100, time.Local)), LimitedClaims: common.ToPointer(10), CredentialSubject: CredentialSubject{}, MtProof: true, @@ -3409,7 +3408,7 @@ func TestServer_CreateLink(t *testing.T) { body: CreateLinkRequest{ SchemaID: importedSchema.ID, Expiration: common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)), - CredentialExpiration: &types.Date{Time: time.Date(2000, 8, 15, 14, 30, 45, 100, time.Local)}, + CredentialExpiration: common.ToPointer(time.Date(2000, 8, 15, 14, 30, 45, 100, time.Local)), LimitedClaims: common.ToPointer(10), CredentialSubject: CredentialSubject{"birthday": 19790911, "documentType": true}, MtProof: true, @@ -3426,7 +3425,7 @@ func TestServer_CreateLink(t *testing.T) { body: CreateLinkRequest{ SchemaID: uuid.New(), Expiration: common.ToPointer(time.Date(2025, 8, 15, 14, 30, 45, 100, time.Local)), - CredentialExpiration: &types.Date{Time: time.Date(2000, 8, 15, 14, 30, 45, 100, time.Local)}, + CredentialExpiration: common.ToPointer(time.Date(2000, 8, 15, 14, 30, 45, 100, time.Local)), LimitedClaims: common.ToPointer(10), CredentialSubject: CredentialSubject{"birthday": 19790911, "documentType": 12}, MtProof: true, From 52da4613d8220598b25f993117d711c42689b331 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Mon, 22 Jan 2024 18:47:01 +0100 Subject: [PATCH 052/110] feat: Credential expiration UI is a datetime instead of a date. --- ui/src/adapters/parsers/forms.ts | 40 +++++++++---------- .../credentials/CredentialDetails.tsx | 12 +++++- .../credentials/IssueCredential.tsx | 2 +- .../credentials/IssueCredentialForm.tsx | 9 +++-- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index e9ec7f23f..eb63a9536 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -118,7 +118,7 @@ export type IssueCredentialFormData = { credentialExpiration?: dayjs.Dayjs | null; credentialSubject?: Record; proofTypes: ProofType[]; - refreshService: {enabled: boolean, url: string}; + refreshService: { enabled: boolean; url: string }; schemaID?: string; }; @@ -129,18 +129,18 @@ const issueCredentialFormDataParser = getStrictParser() proofTypes: z .array(z.union([z.literal("MTP"), z.literal("SIG")])) .min(1, "At least one proof type is required"), - refreshService: z.union([ - z.object({ - enabled: z.literal(false), - url: z.string(), - }), - z.object({ - enabled: z.literal(true), - url: z.string().url({ - message: `Refresh service URL must be a valid URL.`, - }) + refreshService: z.union([ + z.object({ + enabled: z.literal(false), + url: z.string(), + }), + z.object({ + enabled: z.literal(true), + url: z.string().url({ + message: `Refresh service URL must be a valid URL.`, }), - ]), + }), + ]), schemaID: z.string().optional(), }) ); @@ -345,18 +345,16 @@ export function serializeCredentialLinkIssuance({ if (serializedSchemaForm.success) { return { data: { - credentialExpiration: credentialExpiration - ? serializeDate(credentialExpiration, "date") - : null, + credentialExpiration: credentialExpiration ? credentialExpiration.toISOString() : null, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: linkAccessibleUntil ? linkAccessibleUntil.toISOString() : null, limitedClaims: linkMaximumIssuance ?? null, mtProof, refreshService: credentialRefreshService ? { - id: credentialRefreshService, - type: "Iden3RefreshService2023", - } + id: credentialRefreshService, + type: "Iden3RefreshService2023", + } : null, schemaID, signatureProof, @@ -402,9 +400,9 @@ export function serializeCredentialIssuance({ mtProof, refreshService: credentialRefreshService ? { - id: credentialRefreshService, - type: "Iden3RefreshService2023", - } + id: credentialRefreshService, + type: "Iden3RefreshService2023", + } : null, signatureProof, type, diff --git a/ui/src/components/credentials/CredentialDetails.tsx b/ui/src/components/credentials/CredentialDetails.tsx index a3c9e11b7..a76b4d607 100644 --- a/ui/src/components/credentials/CredentialDetails.tsx +++ b/ui/src/components/credentials/CredentialDetails.tsx @@ -168,8 +168,16 @@ export function CredentialDetails() { ); } else { - const { createdAt, expiresAt, proofTypes, refreshService, revoked, schemaHash, schemaType, userID } = - credential.data; + const { + createdAt, + expiresAt, + proofTypes, + refreshService, + revoked, + schemaHash, + schemaType, + userID, + } = credential.data; return ( - - - + ) : ( From 2f872c25a7acbe8c9fe733f6d2426bc947ffe931 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Mon, 22 Jan 2024 14:48:34 -0300 Subject: [PATCH 053/110] fix: add revoked credentials to publish state action --- internal/repositories/claims.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index 90b075805..ded7c85ed 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -570,7 +570,7 @@ func (c *claims) GetAllByState(ctx context.Context, conn db.Querier, did *w3c.DI credential_status, core_claim FROM claims - WHERE issuer = $1 AND identity_state IS NULL AND identifier = issuer AND mtp = true + WHERE issuer = $1 AND identity_state IS NULL AND identifier = issuer AND (mtp = true OR revoked = true) `, did.String()) } else { rows, err = conn.Query(ctx, ` @@ -595,7 +595,7 @@ func (c *claims) GetAllByState(ctx context.Context, conn db.Querier, did *w3c.DI core_claim FROM claims LEFT OUTER JOIN identity_states ON claims.identity_state = identity_states.state - WHERE issuer = $1 AND identity_state = $2 AND claims.identifier = issuer AND mtp = true + WHERE issuer = $1 AND identity_state = $2 AND claims.identifier = issuer AND (mtp = true OR revoked = true) `, did.String(), state.Hex()) } From 9e9b23fa27c226d59cf53a7e98a60cc31f6dcc29 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Tue, 23 Jan 2024 10:54:16 +0100 Subject: [PATCH 054/110] chore: Update vite package. --- ui/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/package-lock.json b/ui/package-lock.json index 95bfa0f84..8cc636267 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -9060,9 +9060,9 @@ } }, "node_modules/vite": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", - "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", + "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", "dev": true, "dependencies": { "esbuild": "^0.18.10", From 6cfd8e3c38e0b4aeca63fe058f5d5189ae9dff1d Mon Sep 17 00:00:00 2001 From: x1m3 Date: Tue, 23 Jan 2024 11:26:08 +0100 Subject: [PATCH 055/110] chore: Update vite minimum version --- ui/package-lock.json | 2 +- ui/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/package-lock.json b/ui/package-lock.json index 8cc636267..5a1123beb 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -42,7 +42,7 @@ "stylelint-config-standard-scss": "^11.1.0", "stylelint-prettier": "^4.0.2", "typescript": "^5.2.2", - "vite": "^4.5.0", + "vite": "^4.5.2", "vite-plugin-checker": "^0.6.2", "vite-plugin-svgr": "^4.1.0", "vite-tsconfig-paths": "^4.2.1" diff --git a/ui/package.json b/ui/package.json index e090d3d58..8aca71d60 100644 --- a/ui/package.json +++ b/ui/package.json @@ -36,7 +36,7 @@ "stylelint-config-standard-scss": "^11.1.0", "stylelint-prettier": "^4.0.2", "typescript": "^5.2.2", - "vite": "^4.5.0", + "vite": "^4.5.2", "vite-plugin-checker": "^0.6.2", "vite-plugin-svgr": "^4.1.0", "vite-tsconfig-paths": "^4.2.1" From 91ba0c9f9dd16243844ba92b49a2bcdc9ccab90c Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Tue, 23 Jan 2024 09:27:10 -0300 Subject: [PATCH 056/110] fix: get state status endpoint --- internal/api_ui/server_test.go | 83 ++++++++++++++++++++++++------- internal/repositories/identity.go | 2 +- 2 files changed, 65 insertions(+), 20 deletions(-) diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 3243206e4..3c6a9e57d 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -4607,16 +4607,56 @@ func TestServer_GetStateStatus(t *testing.T) { } typeC := "KYCAgeCredential" merklizedRootPosition := "index" - iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + + iden1, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) - did, err := w3c.ParseDID(iden.Identifier) + did1, err := w3c.ParseDID(iden1.Identifier) require.NoError(t, err) - cfg.APIUI.IssuerDID = *did - server := NewServer(&cfg, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) + cfg1 := &config.Configuration{ + APIUI: config.APIUI{ + IssuerDID: *did1, + }, + } - handler := getHandler(ctx, server) + server1 := NewServer(cfg1, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did1, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) + require.NoError(t, err) + handler1 := getHandler(ctx, server1) + + iden2, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + require.NoError(t, err) + + did2, err := w3c.ParseDID(iden2.Identifier) + require.NoError(t, err) + + cfg2 := &config.Configuration{ + APIUI: config.APIUI{ + IssuerDID: *did2, + }, + } + server2 := NewServer(cfg2, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did2, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) + require.NoError(t, err) + handler2 := getHandler(ctx, server2) + + iden3, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + require.NoError(t, err) + + did3, err := w3c.ParseDID(iden3.Identifier) + require.NoError(t, err) + + cfg3 := &config.Configuration{ + APIUI: config.APIUI{ + IssuerDID: *did3, + }, + } + server3 := NewServer(cfg3, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) + cred, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did3, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) + require.NoError(t, err) + require.NoError(t, claimsService.Revoke(ctx, cfg3.APIUI.IssuerDID, uint64(cred.RevNonce), "not valid")) + handler3 := getHandler(ctx, server3) type expected struct { response GetStateStatus200JSONResponse @@ -4625,39 +4665,45 @@ func TestServer_GetStateStatus(t *testing.T) { type testConfig struct { name string + handler http.Handler auth func() (string, string) - cleanUp func() expected expected } for _, tc := range []testConfig{ { - name: "No auth header", - auth: authWrong, + name: "No auth header", + handler: handler1, + auth: authWrong, expected: expected{ httpCode: http.StatusUnauthorized, }, }, { - name: "No states to process", - auth: authOk, + name: "No states to process", + auth: authOk, + handler: handler1, expected: expected{ response: GetStateStatus200JSONResponse{PendingActions: false}, httpCode: http.StatusOK, }, - cleanUp: func() { - cred, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) - require.NoError(t, err) - require.NoError(t, claimsService.Revoke(ctx, cfg.APIUI.IssuerDID, uint64(cred.RevNonce), "not valid")) + }, + { + name: "New state to process because there is a new credential with mtp proof", + handler: handler2, + auth: authOk, + expected: expected{ + response: GetStateStatus200JSONResponse{PendingActions: true}, + httpCode: http.StatusOK, }, }, { - name: "New state to process", - auth: authOk, + name: "New state to process because there is a revoked credential", + handler: handler3, + auth: authOk, expected: expected{ response: GetStateStatus200JSONResponse{PendingActions: true}, httpCode: http.StatusOK, }, - cleanUp: func() {}, }, } { t.Run(tc.name, func(t *testing.T) { @@ -4668,7 +4714,7 @@ func TestServer_GetStateStatus(t *testing.T) { req.SetBasicAuth(tc.auth()) require.NoError(t, err) - handler.ServeHTTP(rr, req) + tc.handler.ServeHTTP(rr, req) require.Equal(t, tc.expected.httpCode, rr.Code) @@ -4677,7 +4723,6 @@ func TestServer_GetStateStatus(t *testing.T) { var response GetStateStatus200JSONResponse require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) assert.Equal(t, tc.expected.response.PendingActions, response.PendingActions) - tc.cleanUp() } }) } diff --git a/internal/repositories/identity.go b/internal/repositories/identity.go index ac01fe1ce..658a2cf04 100644 --- a/internal/repositories/identity.go +++ b/internal/repositories/identity.go @@ -167,7 +167,7 @@ func (i *identity) HasUnprocessedAndFailedStatesByID(ctx context.Context, conn d ( SELECT issuer FROM claims - WHERE identity_state ISNULL AND identifier = issuer + WHERE identity_state ISNULL AND identifier = issuer AND (mtp = true OR revoked = true) UNION SELECT identifier FROM revocation where status = 0 ), transacted_issuers AS From 6d2efb23c6ea99bf5bb24ec56a6b45c8a2d3e759 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Tue, 23 Jan 2024 09:47:17 -0300 Subject: [PATCH 057/110] chore: improve tests --- internal/api_ui/server_test.go | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 3c6a9e57d..e5c6890a0 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -4608,55 +4608,55 @@ func TestServer_GetStateStatus(t *testing.T) { typeC := "KYCAgeCredential" merklizedRootPosition := "index" - iden1, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + idenWithSignatureClaim, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) - did1, err := w3c.ParseDID(iden1.Identifier) + didSignatureClaim, err := w3c.ParseDID(idenWithSignatureClaim.Identifier) require.NoError(t, err) cfg1 := &config.Configuration{ APIUI: config.APIUI{ - IssuerDID: *did1, + IssuerDID: *didSignatureClaim, }, } - server1 := NewServer(cfg1, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) - _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did1, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) + serverWithSignatureClaim := NewServer(cfg1, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(didSignatureClaim, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) require.NoError(t, err) - handler1 := getHandler(ctx, server1) + handlerWithSignatureClaim := getHandler(ctx, serverWithSignatureClaim) - iden2, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + idenWithMTPClaim, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) - did2, err := w3c.ParseDID(iden2.Identifier) + didWithMTPClaim, err := w3c.ParseDID(idenWithMTPClaim.Identifier) require.NoError(t, err) - cfg2 := &config.Configuration{ + cfgWithMTPClaim := &config.Configuration{ APIUI: config.APIUI{ - IssuerDID: *did2, + IssuerDID: *didWithMTPClaim, }, } - server2 := NewServer(cfg2, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) - _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did2, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) + serverWithMTPClaim := NewServer(cfgWithMTPClaim, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(didWithMTPClaim, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) require.NoError(t, err) - handler2 := getHandler(ctx, server2) + handlerWithMTPClaim := getHandler(ctx, serverWithMTPClaim) - iden3, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + idenWithRevokedClaim, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) - did3, err := w3c.ParseDID(iden3.Identifier) + didWithRevokedClaim, err := w3c.ParseDID(idenWithRevokedClaim.Identifier) require.NoError(t, err) - cfg3 := &config.Configuration{ + cfgWithRevokedClaim := &config.Configuration{ APIUI: config.APIUI{ - IssuerDID: *did3, + IssuerDID: *didWithRevokedClaim, }, } - server3 := NewServer(cfg3, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) - cred, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did3, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) + serverWithRevokedClaim := NewServer(cfgWithRevokedClaim, identityService, claimsService, NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) + cred, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(didWithRevokedClaim, schema, credentialSubject, nil, typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(false), nil, true, verifiable.SparseMerkleTreeProof, nil, nil)) require.NoError(t, err) - require.NoError(t, claimsService.Revoke(ctx, cfg3.APIUI.IssuerDID, uint64(cred.RevNonce), "not valid")) - handler3 := getHandler(ctx, server3) + require.NoError(t, claimsService.Revoke(ctx, cfgWithRevokedClaim.APIUI.IssuerDID, uint64(cred.RevNonce), "not valid")) + handlerWithRevokedClaim := getHandler(ctx, serverWithRevokedClaim) type expected struct { response GetStateStatus200JSONResponse @@ -4672,7 +4672,7 @@ func TestServer_GetStateStatus(t *testing.T) { for _, tc := range []testConfig{ { name: "No auth header", - handler: handler1, + handler: handlerWithSignatureClaim, auth: authWrong, expected: expected{ httpCode: http.StatusUnauthorized, @@ -4681,7 +4681,7 @@ func TestServer_GetStateStatus(t *testing.T) { { name: "No states to process", auth: authOk, - handler: handler1, + handler: handlerWithSignatureClaim, expected: expected{ response: GetStateStatus200JSONResponse{PendingActions: false}, httpCode: http.StatusOK, @@ -4689,7 +4689,7 @@ func TestServer_GetStateStatus(t *testing.T) { }, { name: "New state to process because there is a new credential with mtp proof", - handler: handler2, + handler: handlerWithMTPClaim, auth: authOk, expected: expected{ response: GetStateStatus200JSONResponse{PendingActions: true}, @@ -4698,7 +4698,7 @@ func TestServer_GetStateStatus(t *testing.T) { }, { name: "New state to process because there is a revoked credential", - handler: handler3, + handler: handlerWithRevokedClaim, auth: authOk, expected: expected{ response: GetStateStatus200JSONResponse{PendingActions: true}, From 6b118981b535dbd1be8db0a3498908c139a4df89 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 24 Jan 2024 10:14:20 +0100 Subject: [PATCH 058/110] chore: import domain.Refresh service for api dto. --- ui/src/adapters/api/credentials.ts | 14 ++++---------- ui/src/domain/credential.ts | 2 +- ui/src/domain/index.ts | 1 + 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index f69408cac..9d7d8ab0c 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -4,7 +4,7 @@ import { z } from "zod"; import { Response, buildErrorResponse, buildSuccessResponse } from "src/adapters"; import { ID, IDParser, Message, buildAuthorizationHeader, messageParser } from "src/adapters/api"; import { datetimeParser, getListParser, getStrictParser } from "src/adapters/parsers"; -import { Credential, Env, IssuedQRCode, Json, Link, LinkStatus, ProofType } from "src/domain"; +import {Credential, Env, IssuedQRCode, Json, Link, LinkStatus, ProofType, RefreshService} from "src/domain"; import { API_VERSION, QUERY_SEARCH_PARAM, STATUS_SEARCH_PARAM } from "src/utils/constants"; import { List } from "src/utils/types"; @@ -44,7 +44,7 @@ export const credentialParser = getStrictParser()( expiresAt: datetimeParser.nullable(), id: z.string(), proofTypes: proofTypeParser, - refreshService: z.object({ id: z.string(), type: z.string() }).nullable(), + refreshService: z.object({ id: z.string(), type: z.literal("Iden3RefreshService2023") }).nullable(), revNonce: z.number(), revoked: z.boolean(), schemaHash: z.string(), @@ -131,10 +131,7 @@ export type CreateCredential = { credentialSubject: Json; expiration: string | null; mtProof: boolean; - refreshService: { - id: string; - type: "Iden3RefreshService2023"; - } | null; + refreshService: RefreshService | null; signatureProof: boolean; type: string; }; @@ -356,10 +353,7 @@ export type CreateLink = { expiration: string | null; limitedClaims: number | null; mtProof: boolean; - refreshService: { - id: string; - type: "Iden3RefreshService2023"; - } | null; + refreshService: RefreshService | null; schemaID: string; signatureProof: boolean; }; diff --git a/ui/src/domain/credential.ts b/ui/src/domain/credential.ts index d3a666ade..c1e9de92c 100644 --- a/ui/src/domain/credential.ts +++ b/ui/src/domain/credential.ts @@ -4,7 +4,7 @@ export type ProofType = "MTP" | "SIG"; export type RefreshService = { id: string; - type: string; + type: "Iden3RefreshService2023"; }; export type Credential = { diff --git a/ui/src/domain/index.ts b/ui/src/domain/index.ts index 9307f9d06..aa68d218d 100644 --- a/ui/src/domain/index.ts +++ b/ui/src/domain/index.ts @@ -9,6 +9,7 @@ export type { Link, LinkStatus, ProofType, + RefreshService } from "src/domain/credential"; export type { Env } from "src/domain/env"; From 0531439398b75734a54726131426d6b87e451115 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 24 Jan 2024 10:15:42 +0100 Subject: [PATCH 059/110] fix: Credential form rules validated at form level and not on submit. --- ui/src/adapters/parsers/forms.ts | 2 +- .../credentials/IssueCredentialForm.tsx | 30 +++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index eb63a9536..4a6e409cb 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -43,7 +43,7 @@ export type CredentialLinkIssuance = CredentialIssuance & { }; // Parsers -const dayjsInstanceParser = getStrictParser()( +export const dayjsInstanceParser = getStrictParser()( z.custom(isDayjs, { message: "The provided input is not a valid Dayjs instance", }) diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 72bc6fb67..8e8e84f37 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -23,7 +23,7 @@ import { z } from "zod"; import { getApiSchemas } from "src/adapters/api/schemas"; import { getJsonSchemaFromUrl } from "src/adapters/jsonSchemas"; -import { IssueCredentialFormData, serializeSchemaForm } from "src/adapters/parsers/forms"; +import {dayjsInstanceParser, IssueCredentialFormData, serializeSchemaForm} from "src/adapters/parsers/forms"; import IconBack from "src/assets/icons/arrow-narrow-left.svg?react"; import IconRight from "src/assets/icons/arrow-narrow-right.svg?react"; import IconCheckMark from "src/assets/icons/check.svg?react"; @@ -40,6 +40,7 @@ import { ISSUE_CREDENTIAL_LINK, SCHEMA_HASH, SCHEMA_TYPE, + URL_FIELD_ERROR_MESSAGE, VALUE_REQUIRED, } from "src/utils/constants"; import { buildAppError, jsonSchemaErrorToString, notifyError } from "src/utils/error"; @@ -457,7 +458,18 @@ export function IssueCredentialForm({ Enable - + + refreshServiceChecked + ? z.string().url().parseAsync(value) + : Promise.resolve(true), + } + ]} + > - + + refreshServiceChecked + ? dayjsInstanceParser.parseAsync(value) + : Promise.resolve(true), + } + ]} + > Date: Wed, 24 Jan 2024 10:39:15 +0100 Subject: [PATCH 060/110] fix: Validation removed from credentialFormParser transformation --- ui/src/adapters/parsers/forms.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 4a6e409cb..eb3295367 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -164,14 +164,6 @@ export const credentialFormParser = getStrictParser< issueCredential; const { type } = issuanceMethod; - if (refreshService.enabled && credentialExpiration === undefined) { - context.addIssue({ - code: z.ZodIssueCode.custom, - fatal: true, - message: `Credential expiration must set when refresh service is enabled.`, - }); - } - const baseIssuance = { credentialExpiration: credentialExpiration ? credentialExpiration.toDate() : undefined, credentialRefreshService: refreshService.enabled ? refreshService.url : null, From 534fa0b38bb4532946229c60ce71da913f906557 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 24 Jan 2024 11:33:15 +0100 Subject: [PATCH 061/110] chore: Use of serializedate() instead of toISOString() --- ui/src/adapters/parsers/forms.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index eb3295367..552012b7e 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -56,7 +56,7 @@ const formLiteralParser = getStrictParser()( z.boolean(), z.null(), z.undefined(), - dayjsInstanceParser.transform((value) => (value.isValid() ? value.toISOString() : undefined)), + dayjsInstanceParser.transform((value) => (value.isValid() ? serializeDate(value, "date-time") : undefined)), ]) ); @@ -337,9 +337,9 @@ export function serializeCredentialLinkIssuance({ if (serializedSchemaForm.success) { return { data: { - credentialExpiration: credentialExpiration ? credentialExpiration.toISOString() : null, + credentialExpiration: credentialExpiration ? serializeDate(credentialExpiration, "date-time") : null, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, - expiration: linkAccessibleUntil ? linkAccessibleUntil.toISOString() : null, + expiration: linkAccessibleUntil ? serializeDate(linkAccessibleUntil, "date-time") : null, limitedClaims: linkMaximumIssuance ?? null, mtProof, refreshService: credentialRefreshService @@ -388,7 +388,7 @@ export function serializeCredentialIssuance({ data: { credentialSchema, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, - expiration: credentialExpiration ? dayjs(credentialExpiration).toISOString() : null, + expiration: credentialExpiration ? serializeDate(dayjs(credentialExpiration), "date-time") : null, mtProof, refreshService: credentialRefreshService ? { From da6bd60ed78ce2aa91f099731fbdf3196df4adba Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 24 Jan 2024 16:51:55 +0100 Subject: [PATCH 062/110] chore: Parametrize component with an on optional href to use the text as a link --- ui/src/components/credentials/CredentialDetails.tsx | 10 +++++----- ui/src/components/credentials/LinkDetails.tsx | 2 +- ui/src/components/shared/Detail.tsx | 7 ++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ui/src/components/credentials/CredentialDetails.tsx b/ui/src/components/credentials/CredentialDetails.tsx index a76b4d607..76ceb66fd 100644 --- a/ui/src/components/credentials/CredentialDetails.tsx +++ b/ui/src/components/credentials/CredentialDetails.tsx @@ -179,6 +179,8 @@ export function CredentialDetails() { userID, } = credential.data; + const qrCodeLink = window.location.origin + generatePath(ROUTES.credentialIssuedQR.path,{ credentialID: credentialID}) + return ( diff --git a/ui/src/components/credentials/LinkDetails.tsx b/ui/src/components/credentials/LinkDetails.tsx index d51ed2aa4..0baf83da5 100644 --- a/ui/src/components/credentials/LinkDetails.tsx +++ b/ui/src/components/credentials/LinkDetails.tsx @@ -216,7 +216,7 @@ export function LinkDetails() { - + diff --git a/ui/src/components/shared/Detail.tsx b/ui/src/components/shared/Detail.tsx index 56b1b0995..3262add9f 100644 --- a/ui/src/components/shared/Detail.tsx +++ b/ui/src/components/shared/Detail.tsx @@ -6,19 +6,20 @@ import IconCopy from "src/assets/icons/copy-01.svg?react"; export function Detail({ copyable, ellipsisPosition, + href, label, tag, text, }: { copyable?: boolean; ellipsisPosition?: number; + href?: string; label: string; tag?: TagProps; text: string; }) { const { sm } = Grid.useBreakpoint(); const value = ellipsisPosition ? text.slice(0, text.length - ellipsisPosition) : text; - const isUrl = text.startsWith("http://") || text.startsWith("https://"); const element = ( {label} - {isUrl ? ( - + {href ? ( + {element} ) : ( From 3a17739316bb5d491b3a806be57d1a6f6f2d8c13 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 24 Jan 2024 17:52:58 +0100 Subject: [PATCH 063/110] chore: credential refresh service form can be undefined --- ui/src/adapters/parsers/forms.ts | 5 ++--- ui/src/components/credentials/IssueCredentialForm.tsx | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 552012b7e..8c20825f1 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -24,7 +24,7 @@ type FormInput = { [key: string]: FormLiteralInput | FormInput }; type CredentialIssuance = { credentialExpiration: Date | undefined; - credentialRefreshService: string | null; + credentialRefreshService: string | undefined; credentialSubject: Record | undefined; mtProof: boolean; signatureProof: boolean; @@ -36,7 +36,6 @@ export type CredentialDirectIssuance = CredentialIssuance & { }; export type CredentialLinkIssuance = CredentialIssuance & { - credentialRefreshService: string | null; linkAccessibleUntil: Date | undefined; linkMaximumIssuance: number | undefined; type: "credentialLink"; @@ -166,7 +165,7 @@ export const credentialFormParser = getStrictParser< const baseIssuance = { credentialExpiration: credentialExpiration ? credentialExpiration.toDate() : undefined, - credentialRefreshService: refreshService.enabled ? refreshService.url : null, + credentialRefreshService: refreshService.enabled ? refreshService.url : undefined, credentialSubject, mtProof: proofTypes.includes("MTP"), signatureProof: proofTypes.includes("SIG"), diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 8e8e84f37..17f46e76b 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -23,7 +23,7 @@ import { z } from "zod"; import { getApiSchemas } from "src/adapters/api/schemas"; import { getJsonSchemaFromUrl } from "src/adapters/jsonSchemas"; -import {dayjsInstanceParser, IssueCredentialFormData, serializeSchemaForm} from "src/adapters/parsers/forms"; +import {IssueCredentialFormData, dayjsInstanceParser, serializeSchemaForm} from "src/adapters/parsers/forms"; import IconBack from "src/assets/icons/arrow-narrow-left.svg?react"; import IconRight from "src/assets/icons/arrow-narrow-right.svg?react"; import IconCheckMark from "src/assets/icons/check.svg?react"; From f191e3c31195fb9df3896b0c8bcca2c5a7d9fe0d Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 24 Jan 2024 18:09:41 +0100 Subject: [PATCH 064/110] chore: npm run format --- ui/src/adapters/api/credentials.ts | 15 +++++++++++++-- ui/src/adapters/parsers/forms.ts | 12 +++++++++--- .../credentials/CredentialDetails.tsx | 11 ++++------- .../credentials/IssueCredentialForm.tsx | 17 +++++++++++------ ui/src/domain/index.ts | 2 +- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 9d7d8ab0c..48a53ac6a 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -4,7 +4,16 @@ import { z } from "zod"; import { Response, buildErrorResponse, buildSuccessResponse } from "src/adapters"; import { ID, IDParser, Message, buildAuthorizationHeader, messageParser } from "src/adapters/api"; import { datetimeParser, getListParser, getStrictParser } from "src/adapters/parsers"; -import {Credential, Env, IssuedQRCode, Json, Link, LinkStatus, ProofType, RefreshService} from "src/domain"; +import { + Credential, + Env, + IssuedQRCode, + Json, + Link, + LinkStatus, + ProofType, + RefreshService, +} from "src/domain"; import { API_VERSION, QUERY_SEARCH_PARAM, STATUS_SEARCH_PARAM } from "src/utils/constants"; import { List } from "src/utils/types"; @@ -44,7 +53,9 @@ export const credentialParser = getStrictParser()( expiresAt: datetimeParser.nullable(), id: z.string(), proofTypes: proofTypeParser, - refreshService: z.object({ id: z.string(), type: z.literal("Iden3RefreshService2023") }).nullable(), + refreshService: z + .object({ id: z.string(), type: z.literal("Iden3RefreshService2023") }) + .nullable(), revNonce: z.number(), revoked: z.boolean(), schemaHash: z.string(), diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index 8c20825f1..c92f1d542 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -55,7 +55,9 @@ const formLiteralParser = getStrictParser()( z.boolean(), z.null(), z.undefined(), - dayjsInstanceParser.transform((value) => (value.isValid() ? serializeDate(value, "date-time") : undefined)), + dayjsInstanceParser.transform((value) => + value.isValid() ? serializeDate(value, "date-time") : undefined + ), ]) ); @@ -336,7 +338,9 @@ export function serializeCredentialLinkIssuance({ if (serializedSchemaForm.success) { return { data: { - credentialExpiration: credentialExpiration ? serializeDate(credentialExpiration, "date-time") : null, + credentialExpiration: credentialExpiration + ? serializeDate(credentialExpiration, "date-time") + : null, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, expiration: linkAccessibleUntil ? serializeDate(linkAccessibleUntil, "date-time") : null, limitedClaims: linkMaximumIssuance ?? null, @@ -387,7 +391,9 @@ export function serializeCredentialIssuance({ data: { credentialSchema, credentialSubject: serializedSchemaForm.data === undefined ? {} : serializedSchemaForm.data, - expiration: credentialExpiration ? serializeDate(dayjs(credentialExpiration), "date-time") : null, + expiration: credentialExpiration + ? serializeDate(dayjs(credentialExpiration), "date-time") + : null, mtProof, refreshService: credentialRefreshService ? { diff --git a/ui/src/components/credentials/CredentialDetails.tsx b/ui/src/components/credentials/CredentialDetails.tsx index 76ceb66fd..76916efa6 100644 --- a/ui/src/components/credentials/CredentialDetails.tsx +++ b/ui/src/components/credentials/CredentialDetails.tsx @@ -179,7 +179,9 @@ export function CredentialDetails() { userID, } = credential.data; - const qrCodeLink = window.location.origin + generatePath(ROUTES.credentialIssuedQR.path,{ credentialID: credentialID}) + const qrCodeLink = + window.location.origin + + generatePath(ROUTES.credentialIssuedQR.path, { credentialID: credentialID }); return ( - + diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 17f46e76b..dac913fef 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -23,7 +23,11 @@ import { z } from "zod"; import { getApiSchemas } from "src/adapters/api/schemas"; import { getJsonSchemaFromUrl } from "src/adapters/jsonSchemas"; -import {IssueCredentialFormData, dayjsInstanceParser, serializeSchemaForm} from "src/adapters/parsers/forms"; +import { + IssueCredentialFormData, + dayjsInstanceParser, + serializeSchemaForm, +} from "src/adapters/parsers/forms"; import IconBack from "src/assets/icons/arrow-narrow-left.svg?react"; import IconRight from "src/assets/icons/arrow-narrow-right.svg?react"; import IconCheckMark from "src/assets/icons/check.svg?react"; @@ -467,9 +471,9 @@ export function IssueCredentialForm({ refreshServiceChecked ? z.string().url().parseAsync(value) : Promise.resolve(true), - } - ]} - > + }, + ]} + > refreshServiceChecked ? dayjsInstanceParser.parseAsync(value) : Promise.resolve(true), - } + }, ]} > Date: Thu, 25 Jan 2024 12:16:11 +0100 Subject: [PATCH 065/110] fix: Change error message. --- ui/src/components/credentials/IssueCredentialForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index dac913fef..7829912a3 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -487,7 +487,7 @@ export function IssueCredentialForm({ rules={[ { message: - "Credential expiration must set when refresh service is enabled.", + "Credential expiration must be set when the refresh service is enabled", validator: (_, value) => refreshServiceChecked ? dayjsInstanceParser.parseAsync(value) From 6e251e6bb584537da339e7db830ab6a8d852e540 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 25 Jan 2024 12:28:10 +0100 Subject: [PATCH 066/110] chore: IssueCredentialFormData better parsing of refreshService url --- ui/src/adapters/parsers/forms.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/forms.ts index c92f1d542..3a6dc4d9b 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/forms.ts @@ -130,18 +130,10 @@ const issueCredentialFormDataParser = getStrictParser() proofTypes: z .array(z.union([z.literal("MTP"), z.literal("SIG")])) .min(1, "At least one proof type is required"), - refreshService: z.union([ - z.object({ - enabled: z.literal(false), - url: z.string(), - }), - z.object({ - enabled: z.literal(true), - url: z.string().url({ - message: `Refresh service URL must be a valid URL.`, - }), - }), - ]), + refreshService: z.object({ + enabled: z.boolean(), + url: z.union([z.string().url(), z.literal("")]), + }), schemaID: z.string().optional(), }) ); From b5269318b7c1d7b0ddfa67e3c740e3b3c8afa73e Mon Sep 17 00:00:00 2001 From: x1m3 Date: Thu, 25 Jan 2024 15:42:25 +0100 Subject: [PATCH 067/110] fix: Format links as links instead of text. --- ui/src/components/schemas/ImportSchemaPreview.tsx | 2 +- ui/src/components/schemas/SchemaDetails.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/components/schemas/ImportSchemaPreview.tsx b/ui/src/components/schemas/ImportSchemaPreview.tsx index 7760da666..2e75e91a4 100644 --- a/ui/src/components/schemas/ImportSchemaPreview.tsx +++ b/ui/src/components/schemas/ImportSchemaPreview.tsx @@ -65,7 +65,7 @@ export function ImportSchemaPreview({ text={schemaHash || "An error occurred while calculating Hash."} /> - + diff --git a/ui/src/components/schemas/SchemaDetails.tsx b/ui/src/components/schemas/SchemaDetails.tsx index 5ff4703d4..aed5cb269 100644 --- a/ui/src/components/schemas/SchemaDetails.tsx +++ b/ui/src/components/schemas/SchemaDetails.tsx @@ -201,7 +201,7 @@ export function SchemaDetails() { - + From d373a2f1887b98620b375d61ce6f0f5d61935972 Mon Sep 17 00:00:00 2001 From: Javi Date: Tue, 30 Jan 2024 14:00:51 +0100 Subject: [PATCH 068/110] fix: could not create links with new type property in credential status schema (#612) --- internal/jsonschema/schema.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/jsonschema/schema.go b/internal/jsonschema/schema.go index a42f1c5da..75577c77f 100644 --- a/internal/jsonschema/schema.go +++ b/internal/jsonschema/schema.go @@ -202,7 +202,8 @@ func createDummyVC(cSubject map[string]interface{}, schemaType string, schemaCon "type": "JsonSchemaValidator2018", }, "credentialStatus": map[string]interface{}{ - "id": "testStatus", + "id": "testStatus", + "type": "someType", }, "credentialSubject": cSubject, "id": "https://someURL/someschemaContext.jsonld", From 9fec695b189c15790bd0add46dc65fd45626b54c Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Tue, 30 Jan 2024 18:31:20 +0100 Subject: [PATCH 069/110] Implement remote sorting --- ui/src/adapters/api/connections.ts | 12 +++++-- ui/src/adapters/api/credentials.ts | 14 ++++++-- ui/src/adapters/api/index.ts | 12 +++++++ ui/src/adapters/parsers/index.ts | 4 +-- ui/src/adapters/parsers/{forms.ts => view.ts} | 19 +++++++++++ .../connections/ConnectionsTable.tsx | 23 ++++++++++--- .../credentials/CredentialsTable.tsx | 33 ++++++++++++------- .../credentials/IssuanceMethodForm.tsx | 2 +- .../credentials/IssueCredential.tsx | 2 +- .../credentials/IssueCredentialForm.tsx | 2 +- 10 files changed, 98 insertions(+), 25 deletions(-) rename ui/src/adapters/parsers/{forms.ts => view.ts} (95%) diff --git a/ui/src/adapters/api/connections.ts b/ui/src/adapters/api/connections.ts index e0c94b1e3..68940580b 100644 --- a/ui/src/adapters/api/connections.ts +++ b/ui/src/adapters/api/connections.ts @@ -2,7 +2,13 @@ import axios from "axios"; import { z } from "zod"; import { Response, buildErrorResponse, buildSuccessResponse } from "src/adapters"; -import { Message, buildAuthorizationHeader, messageParser } from "src/adapters/api"; +import { + Message, + Sorter, + buildAuthorizationHeader, + messageParser, + serializeSorters, +} from "src/adapters/api"; import { credentialParser } from "src/adapters/api/credentials"; import { datetimeParser, @@ -57,7 +63,7 @@ export async function getConnection({ export async function getConnections({ credentials, env, - params: { maxResults, page, query }, + params: { maxResults, page, query, sorters }, signal, }: { credentials: boolean; @@ -66,6 +72,7 @@ export async function getConnections({ maxResults?: number; page?: number; query?: string; + sorters?: Sorter[]; }; signal?: AbortSignal; }): Promise>> { @@ -81,6 +88,7 @@ export async function getConnections({ ...(credentials ? { credentials: "true" } : {}), ...(maxResults !== undefined ? { max_results: maxResults.toString() } : {}), ...(page !== undefined ? { page: page.toString() } : {}), + ...(sorters !== undefined && sorters.length ? { sort: serializeSorters(sorters) } : {}), }), signal, url: `${API_VERSION}/connections`, diff --git a/ui/src/adapters/api/credentials.ts b/ui/src/adapters/api/credentials.ts index 53cb61d68..afb48ed97 100644 --- a/ui/src/adapters/api/credentials.ts +++ b/ui/src/adapters/api/credentials.ts @@ -2,7 +2,15 @@ import axios from "axios"; import { z } from "zod"; import { Response, buildErrorResponse, buildSuccessResponse } from "src/adapters"; -import { ID, IDParser, Message, buildAuthorizationHeader, messageParser } from "src/adapters/api"; +import { + ID, + IDParser, + Message, + Sorter, + buildAuthorizationHeader, + messageParser, + serializeSorters, +} from "src/adapters/api"; import { datetimeParser, getListParser, @@ -103,7 +111,7 @@ export async function getCredential({ export async function getCredentials({ env, - params: { did, maxResults, page, query, status }, + params: { did, maxResults, page, query, sorters, status }, signal, }: { env: Env; @@ -112,6 +120,7 @@ export async function getCredentials({ maxResults?: number; page?: number; query?: string; + sorters?: Sorter[]; status?: CredentialStatus; }; signal?: AbortSignal; @@ -129,6 +138,7 @@ export async function getCredentials({ ...(status !== undefined && status !== "all" ? { [STATUS_SEARCH_PARAM]: status } : {}), ...(maxResults !== undefined ? { max_results: maxResults.toString() } : {}), ...(page !== undefined ? { page: page.toString() } : {}), + ...(sorters !== undefined && sorters.length ? { sort: serializeSorters(sorters) } : {}), }), signal, url: `${API_VERSION}/credentials`, diff --git a/ui/src/adapters/api/index.ts b/ui/src/adapters/api/index.ts index c7737877d..f8bd2479e 100644 --- a/ui/src/adapters/api/index.ts +++ b/ui/src/adapters/api/index.ts @@ -3,6 +3,18 @@ import { z } from "zod"; import { getStrictParser } from "src/adapters/parsers"; import { Env } from "src/domain"; +export type Sorter = { field: string; order?: "ascend" | "descend" }; + +export const sorterParser = getStrictParser()( + z.object({ + field: z.string(), + order: z.union([z.literal("ascend"), z.literal("descend")]).optional(), + }) +); + +export const serializeSorters = (sorters: Sorter[]) => + sorters.map(({ field, order }) => `${order === "descend" ? "-" : ""}${field}`).join(","); + export type ID = { id: string; }; diff --git a/ui/src/adapters/parsers/index.ts b/ui/src/adapters/parsers/index.ts index 35592d073..bec2dca95 100644 --- a/ui/src/adapters/parsers/index.ts +++ b/ui/src/adapters/parsers/index.ts @@ -35,7 +35,7 @@ export function getListParser( ); } -const metaParser = getStrictParser()( +const resourceMetaParser = getStrictParser()( z.object({ max_results: z.number().int().min(1), page: z.number().int().min(1), @@ -52,7 +52,7 @@ export function getResourceParser( >()( z.object({ items: getListParser(parser), - meta: metaParser, + meta: resourceMetaParser, }) ); } diff --git a/ui/src/adapters/parsers/forms.ts b/ui/src/adapters/parsers/view.ts similarity index 95% rename from ui/src/adapters/parsers/forms.ts rename to ui/src/adapters/parsers/view.ts index 3a6dc4d9b..fa0a0f843 100644 --- a/ui/src/adapters/parsers/forms.ts +++ b/ui/src/adapters/parsers/view.ts @@ -1,6 +1,7 @@ import dayjs, { isDayjs } from "dayjs"; import { z } from "zod"; +import { Sorter, sorterParser } from "src/adapters/api"; import { CreateCredential, CreateLink } from "src/adapters/api/credentials"; import { jsonParser } from "src/adapters/json"; import { getStrictParser } from "src/adapters/parsers"; @@ -42,6 +43,24 @@ export type CredentialLinkIssuance = CredentialIssuance & { }; // Parsers + +export const tableSorterParser = getStrictParser()( + z.union([ + z + .unknown() + .array() + .transform((unknowns) => + unknowns.reduce((acc: Sorter[], curr): Sorter[] => { + const parsedSorter = sorterParser.safeParse(curr); + return parsedSorter.success && parsedSorter.data.order !== undefined + ? [...acc, parsedSorter.data] + : acc; + }, []) + ), + sorterParser.transform((sorter) => (sorter.order !== undefined ? [sorter] : [])), + ]) +); + export const dayjsInstanceParser = getStrictParser()( z.custom(isDayjs, { message: "The provided input is not a valid Dayjs instance", diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index 2507a36c9..a168af364 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -14,8 +14,10 @@ import { import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate, useSearchParams } from "react-router-dom"; +import { Sorter } from "src/adapters/api"; import { getConnections } from "src/adapters/api/connections"; import { positiveIntegerFromStringParser } from "src/adapters/parsers"; +import { tableSorterParser } from "src/adapters/parsers/view"; import IconCreditCardPlus from "src/assets/icons/credit-card-plus.svg?react"; import IconDots from "src/assets/icons/dots-vertical.svg?react"; import IconInfoCircle from "src/assets/icons/info-circle.svg?react"; @@ -67,6 +69,7 @@ export function ConnectionsTable() { ); const [paginationTotal, setPaginationTotal] = useState(DEFAULT_PAGINATION_TOTAL); + const [sorters, setSorters] = useState(); const paginationPage = paginationPageParsed.success ? paginationPageParsed.data @@ -87,7 +90,9 @@ export function ConnectionsTable() { {userID.split(":").pop()} ), - sorter: ({ id: a }, { id: b }) => a.localeCompare(b), + sorter: { + multiple: 1, + }, title: IDENTIFIER, }, { @@ -180,7 +185,12 @@ export function ConnectionsTable() { const fetchConnections = useCallback( async (signal?: AbortSignal) => { - setConnections({ status: "loading" }); + setConnections((previousConnections) => + isAsyncTaskDataAvailable(previousConnections) + ? { data: previousConnections.data, status: "reloading" } + : { status: "loading" } + ); + const response = await getConnections({ credentials: true, env, @@ -188,6 +198,7 @@ export function ConnectionsTable() { maxResults: paginationMaxResults, page: paginationPage, query: queryParam || undefined, + sorters, }, signal, }); @@ -208,7 +219,7 @@ export function ConnectionsTable() { } } }, - [env, paginationMaxResults, paginationPage, queryParam, updatePaginationParams] + [env, paginationMaxResults, paginationPage, queryParam, sorters, updatePaginationParams] ); const onSearch = useCallback( @@ -287,7 +298,11 @@ export function ConnectionsTable() { ), }} - onChange={({ current, pageSize, total }) => { + onChange={({ current, pageSize, total }, _, sorters) => { + const parsedSorters = tableSorterParser.safeParse(sorters); + if (parsedSorters.success) { + setSorters(parsedSorters.data); + } setPaginationTotal(total || DEFAULT_PAGINATION_TOTAL); updatePaginationParams({ maxResults: pageSize, page: current }); }} diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index b4b3cb7d1..1d4a7bdae 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -17,8 +17,10 @@ import dayjs from "dayjs"; import { useCallback, useEffect, useState } from "react"; import { Link, generatePath, useNavigate, useSearchParams } from "react-router-dom"; +import { Sorter } from "src/adapters/api"; import { credentialStatusParser, getCredentials } from "src/adapters/api/credentials"; import { positiveIntegerFromStringParser } from "src/adapters/parsers"; +import { tableSorterParser } from "src/adapters/parsers/view"; import IconCreditCardPlus from "src/assets/icons/credit-card-plus.svg?react"; import IconCreditCardRefresh from "src/assets/icons/credit-card-refresh.svg?react"; import IconDots from "src/assets/icons/dots-vertical.svg?react"; @@ -82,6 +84,7 @@ export function CredentialsTable() { ); const [paginationTotal, setPaginationTotal] = useState(DEFAULT_PAGINATION_TOTAL); + const [sorters, setSorters] = useState(); const paginationPage = paginationPageParsed.success ? paginationPageParsed.data @@ -104,7 +107,9 @@ export function CredentialsTable() { {schemaType} ), - sorter: ({ schemaType: a }, { schemaType: b }) => a.localeCompare(b), + sorter: { + multiple: 1, + }, title: "Credential", }, { @@ -113,7 +118,9 @@ export function CredentialsTable() { render: (createdAt: Credential["createdAt"]) => ( {formatDate(createdAt)} ), - sorter: ({ createdAt: a }, { createdAt: b }) => a.getTime() - b.getTime(), + sorter: { + multiple: 2, + }, title: ISSUE_DATE, }, { @@ -130,14 +137,8 @@ export function CredentialsTable() { "-" ), responsive: ["md"], - sorter: ({ expiresAt: a }, { expiresAt: b }) => { - if (a && b) { - return a.getTime() - b.getTime(); - } else if (a) { - return -1; - } else { - return 1; - } + sorter: { + multiple: 3, }, title: EXPIRATION, }, @@ -148,7 +149,9 @@ export function CredentialsTable() { {revoked ? "Revoked" : "-"} ), responsive: ["sm"], - sorter: ({ revoked: a }, { revoked: b }) => (a === b ? 0 : a ? 1 : -1), + sorter: { + multiple: 4, + }, title: REVOCATION, }, { @@ -236,6 +239,7 @@ export function CredentialsTable() { maxResults: paginationMaxResults, page: paginationPage, query: queryParam || undefined, + sorters, status: credentialStatus, }, signal, @@ -262,6 +266,7 @@ export function CredentialsTable() { paginationMaxResults, paginationPage, queryParam, + sorters, credentialStatus, updatePaginationParams, ] @@ -356,7 +361,11 @@ export function CredentialsTable() { ), }} - onChange={({ current, pageSize, total }) => { + onChange={({ current, pageSize, total }, _, sorters) => { + const parsedSorters = tableSorterParser.safeParse(sorters); + if (parsedSorters.success) { + setSorters(parsedSorters.data); + } setPaginationTotal(total || DEFAULT_PAGINATION_TOTAL); updatePaginationParams({ maxResults: pageSize, page: current }); }} diff --git a/ui/src/components/credentials/IssuanceMethodForm.tsx b/ui/src/components/credentials/IssuanceMethodForm.tsx index 4ba172d73..fc66e47db 100644 --- a/ui/src/components/credentials/IssuanceMethodForm.tsx +++ b/ui/src/components/credentials/IssuanceMethodForm.tsx @@ -17,7 +17,7 @@ import dayjs from "dayjs"; import { useCallback, useEffect, useState } from "react"; import { getConnections } from "src/adapters/api/connections"; -import { IssuanceMethodFormData, issuanceMethodFormDataParser } from "src/adapters/parsers/forms"; +import { IssuanceMethodFormData, issuanceMethodFormDataParser } from "src/adapters/parsers/view"; import IconRight from "src/assets/icons/arrow-narrow-right.svg?react"; import { useEnvContext } from "src/contexts/Env"; import { AppError, Connection } from "src/domain"; diff --git a/ui/src/components/credentials/IssueCredential.tsx b/ui/src/components/credentials/IssueCredential.tsx index f3834bb64..8fd8060b1 100644 --- a/ui/src/components/credentials/IssueCredential.tsx +++ b/ui/src/components/credentials/IssueCredential.tsx @@ -11,7 +11,7 @@ import { credentialFormParser, serializeCredentialIssuance, serializeCredentialLinkIssuance, -} from "src/adapters/parsers/forms"; +} from "src/adapters/parsers/view"; import { IssuanceMethodForm } from "src/components/credentials/IssuanceMethodForm"; import { IssueCredentialForm } from "src/components/credentials/IssueCredentialForm"; import { Summary } from "src/components/credentials/Summary"; diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 7829912a3..2ee6ea684 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -27,7 +27,7 @@ import { IssueCredentialFormData, dayjsInstanceParser, serializeSchemaForm, -} from "src/adapters/parsers/forms"; +} from "src/adapters/parsers/view"; import IconBack from "src/assets/icons/arrow-narrow-left.svg?react"; import IconRight from "src/assets/icons/arrow-narrow-right.svg?react"; import IconCheckMark from "src/assets/icons/check.svg?react"; From 1ce125f20edf0b477db852aa90f1428ad50b3e12 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Tue, 30 Jan 2024 18:37:04 +0100 Subject: [PATCH 070/110] Remove multiple sorting in connections table --- ui/src/components/connections/ConnectionsTable.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index a168af364..7f457b137 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -90,9 +90,7 @@ export function ConnectionsTable() { {userID.split(":").pop()} ), - sorter: { - multiple: 1, - }, + sorter: true, title: IDENTIFIER, }, { From 4446b1f0de05612f610dd2853dd99e75adbe43f9 Mon Sep 17 00:00:00 2001 From: Alex Monso Date: Mon, 12 Feb 2024 19:54:24 +0100 Subject: [PATCH 071/110] Store the sorting state in the URL --- ui/src/adapters/api/index.ts | 19 +++--- ui/src/adapters/parsers/view.ts | 35 +++++++++-- .../connections/ConnectionsTable.tsx | 58 +++++++++-------- .../credentials/CredentialsTable.tsx | 63 +++++++++++-------- ui/src/utils/constants.ts | 1 + 5 files changed, 109 insertions(+), 67 deletions(-) diff --git a/ui/src/adapters/api/index.ts b/ui/src/adapters/api/index.ts index f8bd2479e..89af346a3 100644 --- a/ui/src/adapters/api/index.ts +++ b/ui/src/adapters/api/index.ts @@ -3,18 +3,21 @@ import { z } from "zod"; import { getStrictParser } from "src/adapters/parsers"; import { Env } from "src/domain"; -export type Sorter = { field: string; order?: "ascend" | "descend" }; - -export const sorterParser = getStrictParser()( - z.object({ - field: z.string(), - order: z.union([z.literal("ascend"), z.literal("descend")]).optional(), - }) -); +export type Sorter = { field: string; order: "ascend" | "descend" }; export const serializeSorters = (sorters: Sorter[]) => sorters.map(({ field, order }) => `${order === "descend" ? "-" : ""}${field}`).join(","); +export const parseSorters = (value: string | null) => + value === null || value === "" + ? [] + : value.split(",").map( + (field): Sorter => ({ + field: field.replace(/^-/, ""), + order: field.startsWith("-") ? "descend" : "ascend", + }) + ); + export type ID = { id: string; }; diff --git a/ui/src/adapters/parsers/view.ts b/ui/src/adapters/parsers/view.ts index fa0a0f843..490d29ec3 100644 --- a/ui/src/adapters/parsers/view.ts +++ b/ui/src/adapters/parsers/view.ts @@ -1,7 +1,7 @@ import dayjs, { isDayjs } from "dayjs"; import { z } from "zod"; -import { Sorter, sorterParser } from "src/adapters/api"; +import { Sorter } from "src/adapters/api"; import { CreateCredential, CreateLink } from "src/adapters/api/credentials"; import { jsonParser } from "src/adapters/json"; import { getStrictParser } from "src/adapters/parsers"; @@ -43,21 +43,44 @@ export type CredentialLinkIssuance = CredentialIssuance & { }; // Parsers +export type TableSorterInput = { field: string; order?: "ascend" | "descend" | undefined }; -export const tableSorterParser = getStrictParser()( +const tableSorterInputParser = getStrictParser()( + z.object({ + field: z.string(), + order: z.union([z.literal("ascend"), z.literal("descend")]).optional(), + }) +); + +export const tableSorterParser = getStrictParser()( z.union([ z .unknown() .array() - .transform((unknowns) => + .transform((unknowns): Sorter[] => unknowns.reduce((acc: Sorter[], curr): Sorter[] => { - const parsedSorter = sorterParser.safeParse(curr); + const parsedSorter = tableSorterInputParser.safeParse(curr); return parsedSorter.success && parsedSorter.data.order !== undefined - ? [...acc, parsedSorter.data] + ? [ + ...acc, + { + field: parsedSorter.data.field, + order: parsedSorter.data.order, + }, + ] : acc; }, []) ), - sorterParser.transform((sorter) => (sorter.order !== undefined ? [sorter] : [])), + tableSorterInputParser.transform((sorter): Sorter[] => + sorter.order !== undefined + ? [ + { + field: sorter.field, + order: sorter.order, + }, + ] + : [] + ), ]) ); diff --git a/ui/src/components/connections/ConnectionsTable.tsx b/ui/src/components/connections/ConnectionsTable.tsx index 7f457b137..6eab513ea 100644 --- a/ui/src/components/connections/ConnectionsTable.tsx +++ b/ui/src/components/connections/ConnectionsTable.tsx @@ -14,7 +14,7 @@ import { import { useCallback, useEffect, useState } from "react"; import { generatePath, useNavigate, useSearchParams } from "react-router-dom"; -import { Sorter } from "src/adapters/api"; +import { Sorter, parseSorters, serializeSorters } from "src/adapters/api"; import { getConnections } from "src/adapters/api/connections"; import { positiveIntegerFromStringParser } from "src/adapters/parsers"; import { tableSorterParser } from "src/adapters/parsers/view"; @@ -46,6 +46,7 @@ import { PAGINATION_MAX_RESULTS_PARAM, PAGINATION_PAGE_PARAM, QUERY_SEARCH_PARAM, + SORT_PARAM, } from "src/utils/constants"; import { notifyParseErrors } from "src/utils/error"; @@ -61,15 +62,17 @@ export function ConnectionsTable() { const [searchParams, setSearchParams] = useSearchParams(); - const paginationPageParsed = positiveIntegerFromStringParser.safeParse( - searchParams.get(PAGINATION_PAGE_PARAM) - ); - const paginationMaxResultsParsed = positiveIntegerFromStringParser.safeParse( - searchParams.get(PAGINATION_MAX_RESULTS_PARAM) - ); + const queryParam = searchParams.get(QUERY_SEARCH_PARAM); + const paginationPageParam = searchParams.get(PAGINATION_PAGE_PARAM); + const paginationMaxResultsParam = searchParams.get(PAGINATION_MAX_RESULTS_PARAM); + const sortParam = searchParams.get(SORT_PARAM); + + const sorters = parseSorters(sortParam); + const paginationPageParsed = positiveIntegerFromStringParser.safeParse(paginationPageParam); + const paginationMaxResultsParsed = + positiveIntegerFromStringParser.safeParse(paginationMaxResultsParam); const [paginationTotal, setPaginationTotal] = useState(DEFAULT_PAGINATION_TOTAL); - const [sorters, setSorters] = useState(); const paginationPage = paginationPageParsed.success ? paginationPageParsed.data @@ -78,8 +81,6 @@ export function ConnectionsTable() { ? paginationMaxResultsParsed.data : DEFAULT_PAGINATION_MAX_RESULTS; - const queryParam = searchParams.get(QUERY_SEARCH_PARAM); - const tableColumns: TableColumnsType = [ { dataIndex: "userID", @@ -91,6 +92,7 @@ export function ConnectionsTable() { ), sorter: true, + sortOrder: sorters?.find(({ field }) => field === "userID")?.order, title: IDENTIFIER, }, { @@ -159,26 +161,29 @@ export function ConnectionsTable() { }, ]; - const updatePaginationParams = useCallback( - (pagination: { maxResults?: number; page?: number }) => { + const updateUrlParams = useCallback( + ({ maxResults, page, sorters }: { maxResults?: number; page?: number; sorters?: Sorter[] }) => { setSearchParams((previousParams) => { const params = new URLSearchParams(previousParams); params.set( PAGINATION_PAGE_PARAM, - pagination.page !== undefined - ? pagination.page.toString() - : DEFAULT_PAGINATION_PAGE.toString() + page !== undefined ? page.toString() : DEFAULT_PAGINATION_PAGE.toString() ); params.set( PAGINATION_MAX_RESULTS_PARAM, - pagination.maxResults !== undefined - ? pagination.maxResults.toString() + maxResults !== undefined + ? maxResults.toString() : DEFAULT_PAGINATION_MAX_RESULTS.toString() ); + const newSorters = sorters || parseSorters(sortParam); + newSorters.length > 0 + ? params.set(SORT_PARAM, serializeSorters(newSorters)) + : params.delete(SORT_PARAM); + return params; }); }, - [setSearchParams] + [setSearchParams, sortParam] ); const fetchConnections = useCallback( @@ -196,7 +201,7 @@ export function ConnectionsTable() { maxResults: paginationMaxResults, page: paginationPage, query: queryParam || undefined, - sorters, + sorters: parseSorters(sortParam), }, signal, }); @@ -206,7 +211,7 @@ export function ConnectionsTable() { status: "successful", }); setPaginationTotal(response.data.meta.total); - updatePaginationParams({ + updateUrlParams({ maxResults: response.data.meta.max_results, page: response.data.meta.page, }); @@ -217,7 +222,7 @@ export function ConnectionsTable() { } } }, - [env, paginationMaxResults, paginationPage, queryParam, sorters, updatePaginationParams] + [env, paginationMaxResults, paginationPage, queryParam, sortParam, updateUrlParams] ); const onSearch = useCallback( @@ -297,12 +302,13 @@ export function ConnectionsTable() { ), }} onChange={({ current, pageSize, total }, _, sorters) => { - const parsedSorters = tableSorterParser.safeParse(sorters); - if (parsedSorters.success) { - setSorters(parsedSorters.data); - } setPaginationTotal(total || DEFAULT_PAGINATION_TOTAL); - updatePaginationParams({ maxResults: pageSize, page: current }); + const parsedSorters = tableSorterParser.safeParse(sorters); + updateUrlParams({ + maxResults: pageSize, + page: current, + sorters: parsedSorters.success ? parsedSorters.data : [], + }); }} pagination={{ current: paginationPage, diff --git a/ui/src/components/credentials/CredentialsTable.tsx b/ui/src/components/credentials/CredentialsTable.tsx index 1d4a7bdae..971b82447 100644 --- a/ui/src/components/credentials/CredentialsTable.tsx +++ b/ui/src/components/credentials/CredentialsTable.tsx @@ -17,7 +17,7 @@ import dayjs from "dayjs"; import { useCallback, useEffect, useState } from "react"; import { Link, generatePath, useNavigate, useSearchParams } from "react-router-dom"; -import { Sorter } from "src/adapters/api"; +import { Sorter, parseSorters, serializeSorters } from "src/adapters/api"; import { credentialStatusParser, getCredentials } from "src/adapters/api/credentials"; import { positiveIntegerFromStringParser } from "src/adapters/parsers"; import { tableSorterParser } from "src/adapters/parsers/view"; @@ -53,6 +53,7 @@ import { QUERY_SEARCH_PARAM, REVOCATION, REVOKE, + SORT_PARAM, STATUS_SEARCH_PARAM, } from "src/utils/constants"; import { notifyParseError, notifyParseErrors } from "src/utils/error"; @@ -73,18 +74,18 @@ export function CredentialsTable() { const statusParam = searchParams.get(STATUS_SEARCH_PARAM); const queryParam = searchParams.get(QUERY_SEARCH_PARAM); + const paginationPageParam = searchParams.get(PAGINATION_PAGE_PARAM); + const paginationMaxResultsParam = searchParams.get(PAGINATION_MAX_RESULTS_PARAM); + const sortParam = searchParams.get(SORT_PARAM); + + const sorters = parseSorters(sortParam); const parsedStatusParam = credentialStatusParser.safeParse(statusParam); const credentialStatus = parsedStatusParam.success ? parsedStatusParam.data : "all"; - - const paginationPageParsed = positiveIntegerFromStringParser.safeParse( - searchParams.get(PAGINATION_PAGE_PARAM) - ); - const paginationMaxResultsParsed = positiveIntegerFromStringParser.safeParse( - searchParams.get(PAGINATION_MAX_RESULTS_PARAM) - ); + const paginationPageParsed = positiveIntegerFromStringParser.safeParse(paginationPageParam); + const paginationMaxResultsParsed = + positiveIntegerFromStringParser.safeParse(paginationMaxResultsParam); const [paginationTotal, setPaginationTotal] = useState(DEFAULT_PAGINATION_TOTAL); - const [sorters, setSorters] = useState(); const paginationPage = paginationPageParsed.success ? paginationPageParsed.data @@ -110,6 +111,7 @@ export function CredentialsTable() { sorter: { multiple: 1, }, + sortOrder: sorters.find(({ field }) => field === "schemaType")?.order, title: "Credential", }, { @@ -121,6 +123,7 @@ export function CredentialsTable() { sorter: { multiple: 2, }, + sortOrder: sorters.find(({ field }) => field === "createdAt")?.order, title: ISSUE_DATE, }, { @@ -140,6 +143,7 @@ export function CredentialsTable() { sorter: { multiple: 3, }, + sortOrder: sorters.find(({ field }) => field === "expiresAt")?.order, title: EXPIRATION, }, { @@ -152,6 +156,7 @@ export function CredentialsTable() { sorter: { multiple: 4, }, + sortOrder: sorters.find(({ field }) => field === "revoked")?.order, title: REVOCATION, }, { @@ -203,26 +208,29 @@ export function CredentialsTable() { }, ]; - const updatePaginationParams = useCallback( - (pagination: { maxResults?: number; page?: number }) => { + const updateUrlParams = useCallback( + ({ maxResults, page, sorters }: { maxResults?: number; page?: number; sorters?: Sorter[] }) => { setSearchParams((previousParams) => { const params = new URLSearchParams(previousParams); params.set( PAGINATION_PAGE_PARAM, - pagination.page !== undefined - ? pagination.page.toString() - : DEFAULT_PAGINATION_PAGE.toString() + page !== undefined ? page.toString() : DEFAULT_PAGINATION_PAGE.toString() ); params.set( PAGINATION_MAX_RESULTS_PARAM, - pagination.maxResults !== undefined - ? pagination.maxResults.toString() + maxResults !== undefined + ? maxResults.toString() : DEFAULT_PAGINATION_MAX_RESULTS.toString() ); + const newSorters = sorters || parseSorters(sortParam); + newSorters.length > 0 + ? params.set(SORT_PARAM, serializeSorters(newSorters)) + : params.delete(SORT_PARAM); + return params; }); }, - [setSearchParams] + [setSearchParams, sortParam] ); const fetchCredentials = useCallback( @@ -239,7 +247,7 @@ export function CredentialsTable() { maxResults: paginationMaxResults, page: paginationPage, query: queryParam || undefined, - sorters, + sorters: parseSorters(sortParam), status: credentialStatus, }, signal, @@ -250,7 +258,7 @@ export function CredentialsTable() { status: "successful", }); setPaginationTotal(response.data.meta.total); - updatePaginationParams({ + updateUrlParams({ maxResults: response.data.meta.max_results, page: response.data.meta.page, }); @@ -262,13 +270,13 @@ export function CredentialsTable() { } }, [ + credentialStatus, env, paginationMaxResults, paginationPage, queryParam, - sorters, - credentialStatus, - updatePaginationParams, + sortParam, + updateUrlParams, ] ); @@ -362,12 +370,13 @@ export function CredentialsTable() { ), }} onChange={({ current, pageSize, total }, _, sorters) => { - const parsedSorters = tableSorterParser.safeParse(sorters); - if (parsedSorters.success) { - setSorters(parsedSorters.data); - } setPaginationTotal(total || DEFAULT_PAGINATION_TOTAL); - updatePaginationParams({ maxResults: pageSize, page: current }); + const parsedSorters = tableSorterParser.safeParse(sorters); + updateUrlParams({ + maxResults: pageSize, + page: current, + sorters: parsedSorters.success ? parsedSorters.data : [], + }); }} pagination={{ current: paginationPage, diff --git a/ui/src/utils/constants.ts b/ui/src/utils/constants.ts index 193f601c6..0775114a4 100644 --- a/ui/src/utils/constants.ts +++ b/ui/src/utils/constants.ts @@ -36,6 +36,7 @@ export const SCHEMA_SEARCH_PARAM = "schema"; export const STATUS_SEARCH_PARAM = "status"; export const PAGINATION_PAGE_PARAM = "page"; export const PAGINATION_MAX_RESULTS_PARAM = "max_results"; +export const SORT_PARAM = "sort"; export const DEFAULT_PAGINATION_PAGE = 1; export const DEFAULT_PAGINATION_MAX_RESULTS = 10; From 4b79b02f5b4600d5a9ed97284e7c2dfa137c8da2 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 16 Feb 2024 11:36:35 -0300 Subject: [PATCH 072/110] chore: allows scanning same credential link --- internal/core/services/link.go | 104 +++++++++--------- internal/core/services/tests/link_test.go | 6 +- ...d_update_at_column_user_authentication.sql | 11 ++ internal/repositories/connections.go | 4 +- 4 files changed, 69 insertions(+), 56 deletions(-) create mode 100644 internal/db/schema/migrations/202402160649030_add_update_at_column_user_authentication.sql diff --git a/internal/core/services/link.go b/internal/core/services/link.go index 47c9d3535..cde90cbfb 100644 --- a/internal/core/services/link.go +++ b/internal/core/services/link.go @@ -14,10 +14,10 @@ import ( "github.com/iden3/iden3comm/v2/packers" "github.com/iden3/iden3comm/v2/protocol" "github.com/jackc/pgx/v4" + "github.com/polygonid/sh-id-platform/internal/core/event" "github.com/polygonid/sh-id-platform/internal/common" "github.com/polygonid/sh-id-platform/internal/core/domain" - "github.com/polygonid/sh-id-platform/internal/core/event" "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/db" "github.com/polygonid/sh-id-platform/internal/jsonschema" @@ -227,11 +227,6 @@ func (ls *Link) IssueClaim(ctx context.Context, sessionID string, issuerDID w3c. return err } - if len(issuedByUser) > 0 { - log.Info(ctx, "the claim was already issued for the user", "user DID", userDID.String()) - return ErrClaimAlreadyIssued - } - if err := ls.validate(ctx, link); err != nil { err := ls.sessionManager.SetLink(ctx, linkState.CredentialStateCacheKey(linkID.String(), sessionID), *linkState.NewStateError(err)) if err != nil { @@ -242,64 +237,71 @@ func (ls *Link) IssueClaim(ctx context.Context, sessionID string, issuerDID w3c. return err } + var credentialIssuedID uuid.UUID + var credentialIssued *domain.Claim + schema, err := ls.schemaRepository.GetByID(ctx, issuerDID, link.SchemaID) if err != nil { log.Error(ctx, "cannot fetch the schema", "err", err) return err } + if len(issuedByUser) == 0 { + link.CredentialSubject["id"] = userDID.String() + + claimReq := ports.NewCreateClaimRequest(&issuerDID, + schema.URL, + link.CredentialSubject, + link.CredentialExpiration, + schema.Type, + nil, nil, nil, + common.ToPointer(link.CredentialSignatureProof), + common.ToPointer(link.CredentialMTPProof), + &linkID, + true, + credentialStatusType, + link.RefreshService, + nil, + link.DisplayMethod, + ) + + credentialIssued, err = ls.claimsService.CreateCredential(ctx, claimReq) + if err != nil { + log.Error(ctx, "cannot create the claim", "err", err.Error()) + return err + } - link.CredentialSubject["id"] = userDID.String() - - claimReq := ports.NewCreateClaimRequest(&issuerDID, - schema.URL, - link.CredentialSubject, - link.CredentialExpiration, - schema.Type, - nil, nil, nil, - common.ToPointer(link.CredentialSignatureProof), - common.ToPointer(link.CredentialMTPProof), - &linkID, - true, - credentialStatusType, - link.RefreshService, - nil, - link.DisplayMethod, - ) - - credentialIssued, err := ls.claimsService.CreateCredential(ctx, claimReq) - if err != nil { - log.Error(ctx, "cannot create the claim", "err", err.Error()) - return err - } + err = ls.storage.Pgx.BeginFunc(ctx, + func(tx pgx.Tx) error { + link.IssuedClaims += 1 + _, err := ls.linkRepository.Save(ctx, ls.storage.Pgx, link) + if err != nil { + return err + } - var credentialIssuedID uuid.UUID - err = ls.storage.Pgx.BeginFunc(ctx, - func(tx pgx.Tx) error { - link.IssuedClaims += 1 - _, err := ls.linkRepository.Save(ctx, ls.storage.Pgx, link) - if err != nil { - return err - } - - credentialIssuedID, err = ls.claimRepository.Save(ctx, ls.storage.Pgx, credentialIssued) - if err != nil { - return err - } - - if link.CredentialSignatureProof { - err = ls.publisher.Publish(ctx, event.CreateCredentialEvent, &event.CreateCredential{CredentialIDs: []string{credentialIssued.ID.String()}, IssuerID: issuerDID.String()}) + credentialIssuedID, err = ls.claimRepository.Save(ctx, ls.storage.Pgx, credentialIssued) if err != nil { - log.Error(ctx, "publish CreateCredentialEvent", "err", err.Error(), "credential", credentialIssued.ID.String()) + return err } - } - return nil - }) - if err != nil { - return err + return nil + }) + if err != nil { + return err + } + } else { + credentialIssuedID = issuedByUser[0].ID + credentialIssued = issuedByUser[0] } + credentialIssued.ID = credentialIssuedID + if link.CredentialSignatureProof { + err = ls.publisher.Publish(ctx, event.CreateCredentialEvent, &event.CreateCredential{CredentialIDs: []string{credentialIssued.ID.String()}, IssuerID: issuerDID.String()}) + if err != nil { + log.Error(ctx, "publish CreateCredentialEvent", "err", err.Error(), "credential", credentialIssued.ID.String()) + } + } + r := &linkState.QRCodeMessage{ ID: uuid.NewString(), Typ: "application/iden3comm-plain-json", diff --git a/internal/core/services/tests/link_test.go b/internal/core/services/tests/link_test.go index 49bb6675a..f33c179a8 100644 --- a/internal/core/services/tests/link_test.go +++ b/internal/core/services/tests/link_test.go @@ -121,13 +121,13 @@ func Test_link_issueClaim(t *testing.T) { }, }, { - name: "should return error", + name: "should return status pending to publish for same link", did: *did, userDID: *userDID1, LinkID: link2.ID, expected: expected{ - err: services.ErrClaimAlreadyIssued, - status: "", + err: nil, + status: "pendingPublish", issuedClaims: 1, }, }, diff --git a/internal/db/schema/migrations/202402160649030_add_update_at_column_user_authentication.sql b/internal/db/schema/migrations/202402160649030_add_update_at_column_user_authentication.sql new file mode 100644 index 000000000..82222ec6a --- /dev/null +++ b/internal/db/schema/migrations/202402160649030_add_update_at_column_user_authentication.sql @@ -0,0 +1,11 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE user_authentications + ADD COLUMN updated_at timestamptz; +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +ALTER TABLE user_authentications +DROP COLUMN updated_at; +-- +goose StatementEnd \ No newline at end of file diff --git a/internal/repositories/connections.go b/internal/repositories/connections.go index 670e11363..37ef08861 100644 --- a/internal/repositories/connections.go +++ b/internal/repositories/connections.go @@ -56,9 +56,9 @@ func (c *connections) Save(ctx context.Context, conn db.Querier, connection *dom // SaveUserAuthentication creates a new entry in the user_authentications table func (c *connections) SaveUserAuthentication(ctx context.Context, conn db.Querier, connID uuid.UUID, sessID uuid.UUID, mTime time.Time) error { - sql := `INSERT INTO user_authentications (connection_id,session_id,created_at) VALUES($1, $2,$3)` + sql := `INSERT INTO user_authentications (connection_id,session_id,created_at) VALUES($1, $2, $3) ON CONFLICT ON CONSTRAINT user_authentications_session_connection_key DO + UPDATE SET connection_id=$1, session_id=$2, updated_at=$3` _, err := conn.Exec(ctx, sql, connID.String(), sessID.String(), mTime) - return err } From a70d2813116f40316010ec7d6f77b079212c9afa Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 16 Feb 2024 11:43:27 -0300 Subject: [PATCH 073/110] fix: linter --- internal/core/services/link.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/core/services/link.go b/internal/core/services/link.go index cde90cbfb..479c6ee21 100644 --- a/internal/core/services/link.go +++ b/internal/core/services/link.go @@ -14,10 +14,10 @@ import ( "github.com/iden3/iden3comm/v2/packers" "github.com/iden3/iden3comm/v2/protocol" "github.com/jackc/pgx/v4" - "github.com/polygonid/sh-id-platform/internal/core/event" "github.com/polygonid/sh-id-platform/internal/common" "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/polygonid/sh-id-platform/internal/core/event" "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/db" "github.com/polygonid/sh-id-platform/internal/jsonschema" From a984406f02ec72f7bf416d05df6c283523288f3e Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Tue, 20 Feb 2024 07:44:13 -0300 Subject: [PATCH 074/110] chore: add schema_type_description when claims are returned --- internal/repositories/claims.go | 5 ++++- internal/repositories/tests/claims_test.go | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index ded7c85ed..ed612f7e9 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -527,7 +527,8 @@ func (c *claims) GetNonRevokedByConnectionAndIssuerID(ctx context.Context, conn core_claim, revoked, mtp, - claims.created_at + claims.created_at, + schema_type_description FROM claims JOIN connections ON connections.issuer_id = claims.issuer AND connections.user_id = claims.other_identifier LEFT JOIN identity_states ON claims.identity_state = identity_states.state @@ -758,6 +759,7 @@ func processClaims(rows pgx.Rows) ([]*domain.Claim, error) { &claim.Revoked, &claim.MtProof, &claim.CreatedAt, + &claim.SchemaTypeDescription, ) if err != nil { return nil, err @@ -791,6 +793,7 @@ func buildGetAllQueryAndFilters(issuerID w3c.DID, filter *ports.ClaimsFilter) (q "revoked", "mtp", "claims.created_at", + "schema_type_description", } query = `SELECT ##QUERYFIELDS## FROM claims LEFT JOIN identity_states ON claims.identity_state = identity_states.state diff --git a/internal/repositories/tests/claims_test.go b/internal/repositories/tests/claims_test.go index 531895d6b..b82d87201 100644 --- a/internal/repositories/tests/claims_test.go +++ b/internal/repositories/tests/claims_test.go @@ -247,19 +247,19 @@ func TestGetAllByConnectionAndIssuerID(t *testing.T) { t.Run("should get one claim", func(t *testing.T) { r, err := claimsRepo.GetNonRevokedByConnectionAndIssuerID(context.Background(), storage.Pgx, conn, *issuerDID) assert.NoError(t, err) - assert.Equal(t, len(r), 1) + assert.Equal(t, 1, len(r)) }) t.Run("should get no claims, issuerDID not found", func(t *testing.T) { r, err := claimsRepo.GetNonRevokedByConnectionAndIssuerID(context.Background(), storage.Pgx, conn, *userDID) assert.NoError(t, err) - assert.Equal(t, len(r), 0) + assert.Equal(t, 0, len(r)) }) t.Run("should get no claims, connID not found", func(t *testing.T) { r, err := claimsRepo.GetNonRevokedByConnectionAndIssuerID(context.Background(), storage.Pgx, uuid.New(), *issuerDID) assert.NoError(t, err) - assert.Equal(t, len(r), 0) + assert.Equal(t, 0, len(r)) }) } @@ -344,7 +344,7 @@ func TestGetAllByIssuerID(t *testing.T) { claims, total, err := claimsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &tc.filter) require.NoError(t, err) assert.Len(t, claims, tc.expected) - assert.Equal(t, total, uint(len(claims))) + assert.Equal(t, uint(len(claims)), total) }) } } From 3a0a88891aa2cc0a88919bb53b29608b3862cc04 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Tue, 20 Feb 2024 17:38:12 +0100 Subject: [PATCH 075/110] fix: Documentation. Default mode for qrCodes should be link --- api_ui/api.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api_ui/api.yaml b/api_ui/api.yaml index 9e27d830a..4b488cf0e 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -84,7 +84,7 @@ paths: description: > Type: * `link` - (default value) Return a QR code with a link redirection to the raw content. Easier to scan. - * `raw` - Return the raw QR code. (default value) + * `raw` - Return the raw QR code. schema: type: string enum: [ raw, link ] @@ -503,7 +503,7 @@ paths: description: > Type: * `link` - (default value) Return a QR code with a link redirection to the raw content. Easier to scan. - * `raw` - Return the raw QR code. (default value) + * `raw` - Return the raw QR code. - $ref: '#/components/parameters/id' responses: From 14d585c9fcefc018e7f6951fd1f207f15ddac54c Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Tue, 20 Feb 2024 18:10:17 -0300 Subject: [PATCH 076/110] chore: add rhs info to config endpoint --- internal/api/config_handler.go | 24 ++++++++++++++++++++++++ internal/api_ui/config_handler.go | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/internal/api/config_handler.go b/internal/api/config_handler.go index 72e378a5d..ddf4bc5be 100644 --- a/internal/api/config_handler.go +++ b/internal/api/config_handler.go @@ -47,6 +47,30 @@ func (s *Server) GetConfig(_ context.Context, _ GetConfigRequestObject) (GetConf Key: "ISSUER_API_IPFS_GATEWAY_URL", Value: s.cfg.IPFS.GatewayURL, }, + + KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_RHS_MODE", + Value: string(s.cfg.CredentialStatus.RHSMode), + }, + } + + if s.cfg.CredentialStatus.RHSMode == "OnChain" { + variables = append(variables, KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_ONCHAIN_TREE_STORE_SUPPORTED_CONTRACT", + Value: s.cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract, + }) + + variables = append(variables, KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_RHS_CHAIN_ID", + Value: s.cfg.CredentialStatus.OnchainTreeStore.ChainID, + }) + } + + if s.cfg.CredentialStatus.RHSMode == "OffChain" { + variables = append(variables, KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_RHS_URL", + Value: s.cfg.CredentialStatus.RHS.URL, + }) } return variables, nil diff --git a/internal/api_ui/config_handler.go b/internal/api_ui/config_handler.go index 26952d8ca..e4d185253 100644 --- a/internal/api_ui/config_handler.go +++ b/internal/api_ui/config_handler.go @@ -72,6 +72,30 @@ func (s *Server) GetConfig(_ context.Context, _ GetConfigRequestObject) (GetConf Key: "ISSUER_API_IPFS_GATEWAY_URL", Value: s.cfg.IPFS.GatewayURL, }, + + KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_RHS_MODE", + Value: string(s.cfg.CredentialStatus.RHSMode), + }, + } + + if s.cfg.CredentialStatus.RHSMode == "OnChain" { + variables = append(variables, KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_ONCHAIN_TREE_STORE_SUPPORTED_CONTRACT", + Value: s.cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract, + }) + + variables = append(variables, KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_RHS_CHAIN_ID", + Value: s.cfg.CredentialStatus.OnchainTreeStore.ChainID, + }) + } + + if s.cfg.CredentialStatus.RHSMode == "OffChain" { + variables = append(variables, KeyValue{ + Key: "ISSUER_CREDENTIAL_STATUS_RHS_URL", + Value: s.cfg.CredentialStatus.RHS.URL, + }) } return variables, nil From dd1a1a88a66f68cef343eb35ac4a1e1d4e8b63fe Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 23 Feb 2024 08:25:45 -0300 Subject: [PATCH 077/110] chore: remove schema_type_description --- api_ui/api.yaml | 3 -- internal/api_ui/api.gen.go | 47 +++++++++---------- internal/api_ui/responses.go | 29 ++++++------ internal/core/domain/claim.go | 7 ++- internal/core/services/claims.go | 8 +--- ...move_schema_type_description_to_claims.sql | 11 +++++ internal/repositories/claims.go | 43 ++++++----------- 7 files changed, 68 insertions(+), 80 deletions(-) create mode 100644 internal/db/schema/migrations/202402230818397_remove_schema_type_description_to_claims.sql diff --git a/api_ui/api.yaml b/api_ui/api.yaml index 9e27d830a..8f4d0d0f7 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -1291,9 +1291,6 @@ components: userID: type: string example: did:polygonid:polygon:mumbai:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe - schemaTypeDescription: - type: string - example: "KYC Age Credential" refreshService: $ref: '#/components/schemas/RefreshService' displayMethod: diff --git a/internal/api_ui/api.gen.go b/internal/api_ui/api.gen.go index 2fccda29a..102867bc0 100644 --- a/internal/api_ui/api.gen.go +++ b/internal/api_ui/api.gen.go @@ -137,34 +137,33 @@ type CreateCredentialRequest struct { // CreateLinkRequest defines model for CreateLinkRequest. type CreateLinkRequest struct { - CredentialExpiration *time.Time `json:"credentialExpiration,omitempty"` - CredentialSubject CredentialSubject `json:"credentialSubject"` - DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` - Expiration *time.Time `json:"expiration,omitempty"` - LimitedClaims *int `json:"limitedClaims"` - MtProof bool `json:"mtProof"` - RefreshService *RefreshService `json:"refreshService,omitempty"` - SchemaID uuid.UUID `json:"schemaID"` - SignatureProof bool `json:"signatureProof"` + CredentialExpiration *time.Time `json:"credentialExpiration,omitempty"` + CredentialSubject CredentialSubject `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` + Expiration *time.Time `json:"expiration,omitempty"` + LimitedClaims *int `json:"limitedClaims"` + MtProof bool `json:"mtProof"` + RefreshService *RefreshService `json:"refreshService"` + SchemaID uuid.UUID `json:"schemaID"` + SignatureProof bool `json:"signatureProof"` } // Credential defines model for Credential. type Credential struct { - CreatedAt TimeUTC `json:"createdAt"` - CredentialSubject map[string]interface{} `json:"credentialSubject"` - DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` - Expired bool `json:"expired"` - ExpiresAt *TimeUTC `json:"expiresAt"` - Id uuid.UUID `json:"id"` - ProofTypes []string `json:"proofTypes"` - RefreshService *RefreshService `json:"refreshService"` - RevNonce uint64 `json:"revNonce"` - Revoked bool `json:"revoked"` - SchemaHash string `json:"schemaHash"` - SchemaType string `json:"schemaType"` - SchemaTypeDescription *string `json:"schemaTypeDescription,omitempty"` - SchemaUrl string `json:"schemaUrl"` - UserID string `json:"userID"` + CreatedAt TimeUTC `json:"createdAt"` + CredentialSubject map[string]interface{} `json:"credentialSubject"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` + Expired bool `json:"expired"` + ExpiresAt *TimeUTC `json:"expiresAt"` + Id uuid.UUID `json:"id"` + ProofTypes []string `json:"proofTypes"` + RefreshService *RefreshService `json:"refreshService"` + RevNonce uint64 `json:"revNonce"` + Revoked bool `json:"revoked"` + SchemaHash string `json:"schemaHash"` + SchemaType string `json:"schemaType"` + SchemaUrl string `json:"schemaUrl"` + UserID string `json:"userID"` } // CredentialLinkQrCodeResponse defines model for CredentialLinkQrCodeResponse. diff --git a/internal/api_ui/responses.go b/internal/api_ui/responses.go index fb25c075c..9fa96f2bc 100644 --- a/internal/api_ui/responses.go +++ b/internal/api_ui/responses.go @@ -114,21 +114,20 @@ func credentialResponse(w3c *verifiable.W3CCredential, credential *domain.Claim) } return Credential{ - CredentialSubject: w3c.CredentialSubject, - CreatedAt: TimeUTC(*w3c.IssuanceDate), - Expired: expired, - ExpiresAt: expiresAt, - Id: credential.ID, - ProofTypes: proofs, - RevNonce: uint64(credential.RevNonce), - Revoked: credential.Revoked, - SchemaHash: credential.SchemaHash, - SchemaType: shortType(credential.SchemaType), - SchemaUrl: credential.SchemaURL, - UserID: credential.OtherIdentifier, - SchemaTypeDescription: credential.SchemaTypeDescription, - RefreshService: refreshService, - DisplayMethod: displayService, + CredentialSubject: w3c.CredentialSubject, + CreatedAt: TimeUTC(*w3c.IssuanceDate), + Expired: expired, + ExpiresAt: expiresAt, + Id: credential.ID, + ProofTypes: proofs, + RevNonce: uint64(credential.RevNonce), + Revoked: credential.Revoked, + SchemaHash: credential.SchemaHash, + SchemaType: shortType(credential.SchemaType), + SchemaUrl: credential.SchemaURL, + UserID: credential.OtherIdentifier, + RefreshService: refreshService, + DisplayMethod: displayService, } } diff --git a/internal/core/domain/claim.go b/internal/core/domain/claim.go index dae22da35..affff5665 100644 --- a/internal/core/domain/claim.go +++ b/internal/core/domain/claim.go @@ -44,10 +44,9 @@ type Claim struct { CredentialStatus pgtype.JSONB `json:"credential_status"` HIndex string `json:"-"` - MtProof bool `json:"mt_poof"` - LinkID *uuid.UUID `json:"-"` - CreatedAt time.Time `json:"-"` - SchemaTypeDescription *string `json:"schema_type_description"` + MtProof bool `json:"mt_poof"` + LinkID *uuid.UUID `json:"-"` + CreatedAt time.Time `json:"-"` } // Credentials is the type of array of credential diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 0bfe7d302..524000838 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -169,7 +169,7 @@ func (c *claim) CreateCredential(ctx context.Context, req *ports.CreateClaimRequ log.Error(ctx, "loading jsonLdContext", "err", err, "url", jsonLdContext) return nil, err } - credentialType, err := merklize.TypeIDFromContext(jsonLD.BytesNoErr(), req.Type) + _, err = merklize.TypeIDFromContext(jsonLD.BytesNoErr(), req.Type) if err != nil { log.Error(ctx, "getting credential type", "err", err) return nil, err @@ -203,7 +203,7 @@ func (c *claim) CreateCredential(ctx context.Context, req *ports.CreateClaimRequ return nil, err } - claim, err := domain.FromClaimer(coreClaim, req.Schema, credentialType) + claim, err := domain.FromClaimer(coreClaim, req.Schema, req.Type) if err != nil { log.Error(ctx, "cannot obtain the claim from claimer", "err", err) return nil, err @@ -213,7 +213,6 @@ func (c *claim) CreateCredential(ctx context.Context, req *ports.CreateClaimRequ claim.Identifier = &issuerDIDString claim.Issuer = issuerDIDString claim.ID = vcID - claim.SchemaTypeDescription = &req.Type if req.SignatureProof { authClaim, err := c.GetAuthClaim(ctx, req.DID) @@ -314,9 +313,6 @@ func (c *claim) GetByID(ctx context.Context, issID *w3c.DID, id uuid.UUID) (*dom // GetCredentialQrCode creates a credential QR code for the given credential and returns the QR Link to be used func (c *claim) GetCredentialQrCode(ctx context.Context, issID *w3c.DID, id uuid.UUID, hostURL string) (*ports.GetCredentialQrCodeResponse, error) { getCredentialType := func(claim domain.Claim) string { - if claim.SchemaTypeDescription != nil { - return *claim.SchemaTypeDescription - } credentialType := claim.SchemaType const schemaParts = 2 parse := strings.Split(credentialType, "#") diff --git a/internal/db/schema/migrations/202402230818397_remove_schema_type_description_to_claims.sql b/internal/db/schema/migrations/202402230818397_remove_schema_type_description_to_claims.sql new file mode 100644 index 000000000..f2147aac2 --- /dev/null +++ b/internal/db/schema/migrations/202402230818397_remove_schema_type_description_to_claims.sql @@ -0,0 +1,11 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE claims + DROP COLUMN schema_type_description; +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +ALTER TABLE claims + ADD COLUMN schema_type_description text; +-- +goose StatementEnd \ No newline at end of file diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index ed612f7e9..26b730b0a 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -143,9 +143,8 @@ func (c *claims) Save(ctx context.Context, conn db.Querier, claim *domain.Claim) index_hash, mtp, link_id, - created_at, - schema_type_description) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22) + created_at) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING id` err = conn.QueryRow(ctx, s, @@ -169,8 +168,7 @@ func (c *claims) Save(ctx context.Context, conn db.Querier, claim *domain.Claim) claim.HIndex, claim.MtProof, claim.LinkID, - claim.CreatedAt, - claim.SchemaTypeDescription).Scan(&id) + claim.CreatedAt).Scan(&id) } else { s := `INSERT INTO claims ( id, @@ -194,19 +192,18 @@ func (c *claims) Save(ctx context.Context, conn db.Querier, claim *domain.Claim) index_hash, mtp, link_id, - created_at, - schema_type_description + created_at ) VALUES ( - $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23 + $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22 ) ON CONFLICT ON CONSTRAINT claims_pkey DO UPDATE SET ( expiration, updatable, version, rev_nonce, signature_proof, mtp_proof, data, identity_state, - other_identifier, schema_hash, schema_url, schema_type, issuer, credential_status, revoked, core_claim, mtp, link_id, created_at, schema_type_description) + other_identifier, schema_hash, schema_url, schema_type, issuer, credential_status, revoked, core_claim, mtp, link_id, created_at) = (EXCLUDED.expiration, EXCLUDED.updatable, EXCLUDED.version, EXCLUDED.rev_nonce, EXCLUDED.signature_proof, EXCLUDED.mtp_proof, EXCLUDED.data, EXCLUDED.identity_state, EXCLUDED.other_identifier, EXCLUDED.schema_hash, - EXCLUDED.schema_url, EXCLUDED.schema_type, EXCLUDED.issuer, EXCLUDED.credential_status, EXCLUDED.revoked, EXCLUDED.core_claim, EXCLUDED.mtp, EXCLUDED.link_id, EXCLUDED.created_at, EXCLUDED.schema_type_description) + EXCLUDED.schema_url, EXCLUDED.schema_type, EXCLUDED.issuer, EXCLUDED.credential_status, EXCLUDED.revoked, EXCLUDED.core_claim, EXCLUDED.mtp, EXCLUDED.link_id, EXCLUDED.created_at) RETURNING id` err = conn.QueryRow(ctx, s, claim.ID, @@ -230,8 +227,7 @@ func (c *claims) Save(ctx context.Context, conn db.Querier, claim *domain.Claim) claim.HIndex, claim.MtProof, claim.LinkID, - claim.CreatedAt, - claim.SchemaTypeDescription).Scan(&id) + claim.CreatedAt).Scan(&id) } if err == nil { @@ -297,8 +293,7 @@ func (c *claims) GetByRevocationNonce(ctx context.Context, conn db.Querier, iden identity_state, credential_status, core_claim, - mtp, - schema_type_description + mtp FROM claims LEFT JOIN identity_states ON claims.identity_state = identity_states.state WHERE claims.identifier = $1 @@ -338,8 +333,7 @@ func (c *claims) GetByRevocationNonce(ctx context.Context, conn db.Querier, iden &claim.IdentityState, &claim.CredentialStatus, &claim.CoreClaim, - &claim.MtProof, - &claim.SchemaTypeDescription) + &claim.MtProof) if err != nil { return nil, err } @@ -373,8 +367,7 @@ func (c *claims) FindOneClaimBySchemaHash(ctx context.Context, conn db.Querier, identity_state, credential_status, revoked, - core_claim, - schema_type_description + core_claim FROM claims WHERE claims.identifier=$1 AND ( claims.other_identifier = $1 or claims.other_identifier = '') @@ -398,8 +391,7 @@ func (c *claims) FindOneClaimBySchemaHash(ctx context.Context, conn db.Querier, &claim.IdentityState, &claim.CredentialStatus, &claim.Revoked, - &claim.CoreClaim, - &claim.SchemaTypeDescription) + &claim.CoreClaim) if err == pgx.ErrNoRows { return nil, ErrClaimDoesNotExist @@ -443,8 +435,7 @@ func (c *claims) GetByIdAndIssuer(ctx context.Context, conn db.Querier, identifi core_claim, mtp, revoked, - link_id, - schema_type_description + link_id FROM claims WHERE claims.identifier = $1 AND claims.id = $2`, identifier.String(), claimID).Scan( &claim.ID, @@ -466,8 +457,7 @@ func (c *claims) GetByIdAndIssuer(ctx context.Context, conn db.Querier, identifi &claim.CoreClaim, &claim.MtProof, &claim.Revoked, - &claim.LinkID, - &claim.SchemaTypeDescription) + &claim.LinkID) if err != nil && err == pgx.ErrNoRows { return nil, ErrClaimDoesNotExist @@ -527,8 +517,7 @@ func (c *claims) GetNonRevokedByConnectionAndIssuerID(ctx context.Context, conn core_claim, revoked, mtp, - claims.created_at, - schema_type_description + claims.created_at FROM claims JOIN connections ON connections.issuer_id = claims.issuer AND connections.user_id = claims.other_identifier LEFT JOIN identity_states ON claims.identity_state = identity_states.state @@ -759,7 +748,6 @@ func processClaims(rows pgx.Rows) ([]*domain.Claim, error) { &claim.Revoked, &claim.MtProof, &claim.CreatedAt, - &claim.SchemaTypeDescription, ) if err != nil { return nil, err @@ -793,7 +781,6 @@ func buildGetAllQueryAndFilters(issuerID w3c.DID, filter *ports.ClaimsFilter) (q "revoked", "mtp", "claims.created_at", - "schema_type_description", } query = `SELECT ##QUERYFIELDS## FROM claims LEFT JOIN identity_states ON claims.identity_state = identity_states.state From 20ca8a42419eed217cacd33edeff1ced3ddacced Mon Sep 17 00:00:00 2001 From: jperez Date: Fri, 23 Feb 2024 15:22:53 +0100 Subject: [PATCH 078/110] chore: updating open-api to v2 --- Makefile | 2 +- api/api.yaml | 4 ---- api/spec.html | 10 ++++++++++ api_ui/api.yaml | 4 ---- api_ui/spec.html | 10 ++++++++++ go.mod | 15 ++++++++------- go.sum | 16 ++++++++++++++++ internal/api/api.gen.go | 32 ++++++++++++++++---------------- internal/api_ui/api.gen.go | 38 +++++++++++++++++++------------------- 9 files changed, 80 insertions(+), 51 deletions(-) diff --git a/Makefile b/Makefile index 21ab275ed..53fcf8544 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ test-race: $(BIN)/oapi-codegen: tools.go go.mod go.sum ## install code generator for API files. go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen - $(GO) install github.com/deepmap/oapi-codegen/cmd/oapi-codegen + $(GO) install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen .PHONY: api api: $(BIN)/oapi-codegen diff --git a/api/api.yaml b/api/api.yaml index 1d5379726..d72a09779 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -5,10 +5,6 @@ info: Documentation for the Issuer version: "1" -servers: - - description: Local - url: http://localhost:3001 - tags: - name: Identity description: Collection of endpoints related to Identity diff --git a/api/spec.html b/api/spec.html index bee791c0e..fb8d694bd 100644 --- a/api/spec.html +++ b/api/spec.html @@ -8,6 +8,7 @@ + \ No newline at end of file diff --git a/api_ui/api.yaml b/api_ui/api.yaml index 8f4d0d0f7..11dcb78ce 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -5,10 +5,6 @@ info: Documentation for the Issuer - UI API version: "1" -servers: - - description: Local - url: http://localhost:3002 - tags: - name: Credential description: Collection of endpoints related to Credential diff --git a/api_ui/spec.html b/api_ui/spec.html index 30a99c7fa..3eb6d3aae 100644 --- a/api_ui/spec.html +++ b/api_ui/spec.html @@ -8,6 +8,7 @@ + \ No newline at end of file diff --git a/go.mod b/go.mod index b4c6a5e1c..9bb24e088 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,13 @@ require ( github.com/alicebob/miniredis/v2 v2.31.0 github.com/deepmap/oapi-codegen v1.16.2 github.com/ethereum/go-ethereum v1.13.4 - github.com/getkin/kin-openapi v0.120.0 + github.com/getkin/kin-openapi v0.122.0 github.com/go-chi/chi/v5 v5.0.10 github.com/go-chi/cors v1.2.1 github.com/go-redis/cache/v8 v8.4.4 github.com/go-redis/redis/v8 v8.11.5 github.com/golangci/golangci-lint v1.55.2 - github.com/google/uuid v1.4.0 + github.com/google/uuid v1.6.0 github.com/hashicorp/go-retryablehttp v0.7.5 github.com/hashicorp/vault/api v1.10.0 github.com/hashicorp/vault/api/auth/userpass v0.5.0 @@ -39,11 +39,11 @@ require ( github.com/jackc/pgx/v4 v4.18.1 github.com/jmoiron/sqlx v1.3.5 github.com/joho/godotenv v1.5.1 - github.com/labstack/gommon v0.4.0 + github.com/labstack/gommon v0.4.2 github.com/lib/pq v1.10.9 github.com/mitchellh/mapstructure v1.5.0 github.com/mr-tron/base58 v1.2.0 - github.com/oapi-codegen/runtime v1.0.0 + github.com/oapi-codegen/runtime v1.1.1 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/pkg/errors v0.9.1 @@ -111,6 +111,7 @@ require ( github.com/dchest/blake512 v1.0.0 // indirect github.com/deckarep/golang-set/v2 v2.3.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/deepmap/oapi-codegen/v2 v2.1.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 // indirect @@ -220,7 +221,7 @@ require ( github.com/maratori/testpackage v1.1.1 // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect @@ -320,11 +321,11 @@ require ( go.uber.org/zap v1.25.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.3.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.15.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect diff --git a/go.sum b/go.sum index 82415d4b0..2b7e3c71a 100644 --- a/go.sum +++ b/go.sum @@ -200,6 +200,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etly github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/deepmap/oapi-codegen v1.16.2 h1:xGHx0dNqYfy9gE8a7AVgVM8Sd5oF9SEgePzP+UPAUXI= github.com/deepmap/oapi-codegen v1.16.2/go.mod h1:rdYoEA2GE+riuZ91DvpmBX9hJbQpuY9wchXpfQ3n+ho= +github.com/deepmap/oapi-codegen/v2 v2.1.0 h1:I/NMVhJCtuvL9x+S2QzZKpSjGi33oDZwPRdemvOZWyQ= +github.com/deepmap/oapi-codegen/v2 v2.1.0/go.mod h1:R1wL226vc5VmCNJUvMyYr3hJMm5reyv25j952zAVXZ8= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= @@ -239,6 +241,8 @@ github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlya github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/getkin/kin-openapi v0.120.0 h1:MqJcNJFrMDFNc07iwE8iFC5eT2k/NPUFDIpNeiZv8Jg= github.com/getkin/kin-openapi v0.120.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= +github.com/getkin/kin-openapi v0.122.0 h1:WB9Jbl0Hp/T79/JF9xlSW5Kl9uYdk/AWD0yAd9HOM10= +github.com/getkin/kin-openapi v0.122.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghostiam/protogetter v0.2.3 h1:qdv2pzo3BpLqezwqfGDLZ+nHEYmc5bUpIdsMbBVwMjw= @@ -407,6 +411,8 @@ github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= @@ -635,6 +641,8 @@ github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= +github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= @@ -700,6 +708,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -767,6 +777,8 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oapi-codegen/runtime v1.0.0 h1:P4rqFX5fMFWqRzY9M/3YF9+aPSPPB06IzP2P7oOxrWo= github.com/oapi-codegen/runtime v1.0.0/go.mod h1:LmCUMQuPB4M/nLXilQXhHw+BLZdDb18B34OO356yJ/A= +github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= +github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/olomix/go-test-pg v1.0.2 h1:4ey3mFBhPx93PdgyshOJI1WrQzqzkWEnb0wL/7UbFMI= @@ -1169,6 +1181,8 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1308,6 +1322,8 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= diff --git a/internal/api/api.gen.go b/internal/api/api.gen.go index 552d74b58..03fc256f8 100644 --- a/internal/api/api.gen.go +++ b/internal/api/api.gen.go @@ -1,6 +1,6 @@ // Package api provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. package api import ( @@ -616,7 +616,7 @@ func (siw *ServerInterfaceWrapper) GetIdentityDetails(w http.ResponseWriter, r * // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -672,7 +672,7 @@ func (siw *ServerInterfaceWrapper) GetClaims(w http.ResponseWriter, r *http.Requ // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -759,7 +759,7 @@ func (siw *ServerInterfaceWrapper) CreateClaim(w http.ResponseWriter, r *http.Re // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -787,7 +787,7 @@ func (siw *ServerInterfaceWrapper) GetRevocationStatus(w http.ResponseWriter, r // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -796,7 +796,7 @@ func (siw *ServerInterfaceWrapper) GetRevocationStatus(w http.ResponseWriter, r // ------------- Path parameter "nonce" ------------- var nonce PathNonce - err = runtime.BindStyledParameterWithLocation("simple", false, "nonce", runtime.ParamLocationPath, chi.URLParam(r, "nonce"), &nonce) + err = runtime.BindStyledParameterWithOptions("simple", "nonce", chi.URLParam(r, "nonce"), &nonce, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "nonce", Err: err}) return @@ -822,7 +822,7 @@ func (siw *ServerInterfaceWrapper) RevokeClaim(w http.ResponseWriter, r *http.Re // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -831,7 +831,7 @@ func (siw *ServerInterfaceWrapper) RevokeClaim(w http.ResponseWriter, r *http.Re // ------------- Path parameter "nonce" ------------- var nonce PathNonce - err = runtime.BindStyledParameterWithLocation("simple", false, "nonce", runtime.ParamLocationPath, chi.URLParam(r, "nonce"), &nonce) + err = runtime.BindStyledParameterWithOptions("simple", "nonce", chi.URLParam(r, "nonce"), &nonce, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "nonce", Err: err}) return @@ -859,7 +859,7 @@ func (siw *ServerInterfaceWrapper) GetClaim(w http.ResponseWriter, r *http.Reque // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -868,7 +868,7 @@ func (siw *ServerInterfaceWrapper) GetClaim(w http.ResponseWriter, r *http.Reque // ------------- Path parameter "id" ------------- var id PathClaim - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -896,7 +896,7 @@ func (siw *ServerInterfaceWrapper) GetClaimQrCode(w http.ResponseWriter, r *http // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -905,7 +905,7 @@ func (siw *ServerInterfaceWrapper) GetClaimQrCode(w http.ResponseWriter, r *http // ------------- Path parameter "id" ------------- var id PathClaim - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -933,7 +933,7 @@ func (siw *ServerInterfaceWrapper) PublishIdentityState(w http.ResponseWriter, r // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -961,7 +961,7 @@ func (siw *ServerInterfaceWrapper) RetryPublishState(w http.ResponseWriter, r *h // ------------- Path parameter "identifier" ------------- var identifier PathIdentifier - err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return @@ -1919,8 +1919,8 @@ type StrictServerInterface interface { RetryPublishState(ctx context.Context, request RetryPublishStateRequestObject) (RetryPublishStateResponseObject, error) } -type StrictHandlerFunc = strictnethttp.StrictHttpHandlerFunc -type StrictMiddlewareFunc = strictnethttp.StrictHttpMiddlewareFunc +type StrictHandlerFunc = strictnethttp.StrictHTTPHandlerFunc +type StrictMiddlewareFunc = strictnethttp.StrictHTTPMiddlewareFunc type StrictHTTPServerOptions struct { RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) diff --git a/internal/api_ui/api.gen.go b/internal/api_ui/api.gen.go index 102867bc0..d12ab7b63 100644 --- a/internal/api_ui/api.gen.go +++ b/internal/api_ui/api.gen.go @@ -1,6 +1,6 @@ // Package api_ui provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. package api_ui import ( @@ -1090,7 +1090,7 @@ func (siw *ServerInterfaceWrapper) GetAuthenticationConnection(w http.ResponseWr // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1180,7 +1180,7 @@ func (siw *ServerInterfaceWrapper) DeleteConnection(w http.ResponseWriter, r *ht // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1227,7 +1227,7 @@ func (siw *ServerInterfaceWrapper) GetConnection(w http.ResponseWriter, r *http. // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1255,7 +1255,7 @@ func (siw *ServerInterfaceWrapper) DeleteConnectionCredentials(w http.ResponseWr // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1283,7 +1283,7 @@ func (siw *ServerInterfaceWrapper) RevokeConnectionCredentials(w http.ResponseWr // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1503,7 +1503,7 @@ func (siw *ServerInterfaceWrapper) DeleteLink(w http.ResponseWriter, r *http.Req // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1531,7 +1531,7 @@ func (siw *ServerInterfaceWrapper) GetLink(w http.ResponseWriter, r *http.Reques // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1559,7 +1559,7 @@ func (siw *ServerInterfaceWrapper) AcivateLink(w http.ResponseWriter, r *http.Re // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1587,7 +1587,7 @@ func (siw *ServerInterfaceWrapper) GetLinkQRCode(w http.ResponseWriter, r *http. // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1631,7 +1631,7 @@ func (siw *ServerInterfaceWrapper) CreateLinkQrCode(w http.ResponseWriter, r *ht // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1657,7 +1657,7 @@ func (siw *ServerInterfaceWrapper) GetRevocationStatus(w http.ResponseWriter, r // ------------- Path parameter "nonce" ------------- var nonce PathNonce - err = runtime.BindStyledParameterWithLocation("simple", false, "nonce", runtime.ParamLocationPath, chi.URLParam(r, "nonce"), &nonce) + err = runtime.BindStyledParameterWithOptions("simple", "nonce", chi.URLParam(r, "nonce"), &nonce, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "nonce", Err: err}) return @@ -1683,7 +1683,7 @@ func (siw *ServerInterfaceWrapper) RevokeCredential(w http.ResponseWriter, r *ht // ------------- Path parameter "nonce" ------------- var nonce PathNonce - err = runtime.BindStyledParameterWithLocation("simple", false, "nonce", runtime.ParamLocationPath, chi.URLParam(r, "nonce"), &nonce) + err = runtime.BindStyledParameterWithOptions("simple", "nonce", chi.URLParam(r, "nonce"), &nonce, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "nonce", Err: err}) return @@ -1711,7 +1711,7 @@ func (siw *ServerInterfaceWrapper) DeleteCredential(w http.ResponseWriter, r *ht // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1739,7 +1739,7 @@ func (siw *ServerInterfaceWrapper) GetCredential(w http.ResponseWriter, r *http. // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1767,7 +1767,7 @@ func (siw *ServerInterfaceWrapper) GetCredentialQrCode(w http.ResponseWriter, r // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -1879,7 +1879,7 @@ func (siw *ServerInterfaceWrapper) GetSchema(w http.ResponseWriter, r *http.Requ // ------------- Path parameter "id" ------------- var id Id - err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -3626,8 +3626,8 @@ type StrictServerInterface interface { GetStateTransactions(ctx context.Context, request GetStateTransactionsRequestObject) (GetStateTransactionsResponseObject, error) } -type StrictHandlerFunc = strictnethttp.StrictHttpHandlerFunc -type StrictMiddlewareFunc = strictnethttp.StrictHttpMiddlewareFunc +type StrictHandlerFunc = strictnethttp.StrictHTTPHandlerFunc +type StrictMiddlewareFunc = strictnethttp.StrictHTTPMiddlewareFunc type StrictHTTPServerOptions struct { RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) From d927e37d71e8c7236924978b8cba73ce5379a701 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Mon, 26 Feb 2024 10:48:59 +0100 Subject: [PATCH 079/110] fix: merge conflict and update some packages --- go.mod | 111 +++++++++++++------------ go.sum | 258 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 186 insertions(+), 183 deletions(-) diff --git a/go.mod b/go.mod index ee5ca4a92..f1cbd3334 100644 --- a/go.mod +++ b/go.mod @@ -3,26 +3,26 @@ module github.com/polygonid/sh-id-platform go 1.21 require ( - github.com/alicebob/miniredis/v2 v2.31.0 + github.com/alicebob/miniredis/v2 v2.31.1 github.com/deepmap/oapi-codegen v1.16.2 - github.com/ethereum/go-ethereum v1.13.8 - github.com/getkin/kin-openapi v0.122.0 + github.com/ethereum/go-ethereum v1.13.13 + github.com/getkin/kin-openapi v0.123.0 github.com/go-chi/chi/v5 v5.0.11 github.com/go-chi/cors v1.2.1 github.com/go-redis/cache/v8 v8.4.4 github.com/go-redis/redis/v8 v8.11.5 - github.com/golangci/golangci-lint v1.55.2 + github.com/golangci/golangci-lint v1.56.2 github.com/google/uuid v1.6.0 github.com/hashicorp/go-retryablehttp v0.7.5 github.com/hashicorp/vault/api v1.10.0 github.com/hashicorp/vault/api/auth/userpass v0.5.0 github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20231116131043-966af42c9b58 github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f - github.com/iden3/go-circuits/v2 v2.0.0 - github.com/iden3/go-iden3-auth/v2 v2.0.0 - github.com/iden3/go-iden3-core/v2 v2.0.3 - github.com/iden3/go-iden3-crypto v0.0.15 - github.com/iden3/go-jwz/v2 v2.0.0 + github.com/iden3/go-circuits/v2 v2.0.1 + github.com/iden3/go-iden3-auth/v2 v2.1.0 + github.com/iden3/go-iden3-core/v2 v2.0.4 + github.com/iden3/go-iden3-crypto v0.0.16 + github.com/iden3/go-jwz/v2 v2.0.1 github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 github.com/iden3/go-merkletree-sql/v2 v2.0.6 github.com/iden3/go-rapidsnark/prover v0.0.10 @@ -30,9 +30,9 @@ require ( github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 - github.com/iden3/go-schema-processor/v2 v2.2.0 - github.com/iden3/iden3comm/v2 v2.0.0 - github.com/iden3/merkletree-proof v0.0.4 + github.com/iden3/go-schema-processor/v2 v2.3.1 + github.com/iden3/iden3comm/v2 v2.2.0 + github.com/iden3/merkletree-proof v0.1.0 github.com/ipfs/go-ipfs-api v0.7.0 github.com/jackc/pgconn v1.14.1 github.com/jackc/pgtype v1.14.0 @@ -50,8 +50,8 @@ require ( github.com/pressly/goose/v3 v3.17.0 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 - golang.org/x/crypto v0.17.0 - golang.org/x/exp v0.0.0-20231226003508-02704c960a9b + golang.org/x/crypto v0.19.0 + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 ) require github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect @@ -63,16 +63,16 @@ require ( github.com/Abirdcfly/dupword v0.0.13 // indirect github.com/Antonboom/errname v0.1.12 // indirect github.com/Antonboom/nilnil v0.1.7 // indirect - github.com/Antonboom/testifylint v0.2.3 // indirect + github.com/Antonboom/testifylint v1.1.2 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect + github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect github.com/VictoriaMetrics/fastcache v1.12.2 // indirect - github.com/alecthomas/go-check-sumtype v0.1.3 // indirect + github.com/alecthomas/go-check-sumtype v0.1.4 // indirect github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect @@ -86,14 +86,14 @@ require ( github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect - github.com/bombsimon/wsl/v3 v3.4.0 // indirect + github.com/bombsimon/wsl/v4 v4.2.1 // indirect github.com/breml/bidichk v0.2.7 // indirect github.com/breml/errchkjson v0.3.6 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/butuzov/ireturn v0.2.2 // indirect + github.com/butuzov/ireturn v0.3.0 // indirect github.com/butuzov/mirror v1.1.0 // indirect - github.com/catenacyber/perfsprint v0.2.0 // indirect - github.com/ccojocar/zxcvbn-go v1.0.1 // indirect + github.com/catenacyber/perfsprint v0.6.0 // indirect + github.com/ccojocar/zxcvbn-go v1.0.2 // indirect github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect @@ -108,38 +108,38 @@ require ( github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041 // indirect github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.11.2 // indirect + github.com/daixiang0/gci v0.12.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dchest/blake512 v1.0.0 // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/deepmap/oapi-codegen/v2 v2.1.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ethereum/c-kzg-4844 v0.4.0 // indirect - github.com/ettle/strcase v0.1.1 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/ettle/strcase v0.2.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect github.com/getsentry/sentry-go v0.25.0 // indirect - github.com/ghostiam/protogetter v0.2.3 // indirect - github.com/go-critic/go-critic v0.9.0 // indirect + github.com/ghostiam/protogetter v0.3.4 // indirect + github.com/go-critic/go-critic v0.11.1 // indirect github.com/go-jose/go-jose/v3 v3.0.1 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/swag v0.22.8 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect - github.com/go-toolsmith/astequal v1.1.0 // indirect + github.com/go-toolsmith/astequal v1.2.0 // indirect github.com/go-toolsmith/astfmt v1.1.0 // indirect github.com/go-toolsmith/astp v1.1.0 // indirect github.com/go-toolsmith/strparse v1.1.0 // indirect github.com/go-toolsmith/typep v1.1.0 // indirect + github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.2 // indirect @@ -156,7 +156,7 @@ require ( github.com/golangci/revgrep v0.5.2 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect + github.com/gordonklaus/ineffassign v0.1.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect @@ -187,12 +187,13 @@ require ( github.com/jackc/pgproto3/v2 v2.3.2 // indirect github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect github.com/jackc/puddle v1.3.0 // indirect - github.com/jgautheron/goconst v1.6.0 // indirect + github.com/jgautheron/goconst v1.7.0 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect + github.com/jjti/go-spancheck v0.5.2 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/julz/importas v0.1.0 // indirect - github.com/kisielk/errcheck v1.6.3 // indirect + github.com/kisielk/errcheck v1.7.0 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect github.com/klauspost/compress v1.17.4 // indirect @@ -200,7 +201,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/kulti/thelper v0.6.3 // indirect - github.com/kunwardeep/paralleltest v1.0.8 // indirect + github.com/kunwardeep/paralleltest v1.0.9 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.5.0 // indirect @@ -215,7 +216,7 @@ require ( github.com/libp2p/go-flow-metrics v0.1.0 // indirect github.com/libp2p/go-libp2p v0.32.2 // indirect github.com/lufeee/execinquery v1.2.1 // indirect - github.com/macabu/inamedparam v0.1.2 // indirect + github.com/macabu/inamedparam v0.1.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect @@ -226,7 +227,7 @@ require ( github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.3.4 // indirect + github.com/mgechev/revive v1.3.7 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect @@ -241,14 +242,14 @@ require ( github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/nakabonne/nestif v0.3.1 // indirect - github.com/nishanths/exhaustive v0.11.0 // indirect + github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.14.1 // indirect + github.com/nunnatsa/ginkgolinter v0.15.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.4.5 // indirect + github.com/polyfloyd/go-errorlint v1.4.8 // indirect github.com/pquerna/cachecontrol v0.2.0 // indirect github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect @@ -268,8 +269,8 @@ require ( github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect - github.com/securego/gosec/v2 v2.18.2 // indirect + github.com/sashamelentyev/usestdlibvars v1.25.0 // indirect + github.com/securego/gosec/v2 v2.19.0 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect @@ -294,7 +295,7 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect - github.com/tetafro/godot v1.4.15 // indirect + github.com/tetafro/godot v1.4.16 // indirect github.com/tetratelabs/wazero v1.6.0 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect @@ -304,7 +305,7 @@ require ( github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect github.com/ultraware/funlen v0.1.0 // indirect - github.com/ultraware/whitespace v0.0.5 // indirect + github.com/ultraware/whitespace v0.1.0 // indirect github.com/uudashr/gocognit v1.1.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect @@ -314,22 +315,22 @@ require ( github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect - github.com/ykadowak/zerologlint v0.1.3 // indirect + github.com/ykadowak/zerologlint v0.1.5 // indirect github.com/yuin/gopher-lua v1.1.0 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect gitlab.com/bosi/decorder v0.4.1 // indirect - go-simpler.org/sloglint v0.1.2 // indirect - go.tmz.dev/musttag v0.7.2 // indirect + go-simpler.org/musttag v0.8.0 // indirect + go-simpler.org/sloglint v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect - golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 // indirect + golang.org/x/mod v0.15.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.16.1 // indirect + golang.org/x/tools v0.18.0 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect @@ -337,9 +338,9 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.4.6 // indirect lukechampine.com/blake3 v1.2.1 // indirect - mvdan.cc/gofumpt v0.5.0 // indirect + mvdan.cc/gofumpt v0.6.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect - mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect + mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 8206a8ae9..bc5201c52 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ github.com/Antonboom/errname v0.1.12 h1:oh9ak2zUtsLp5oaEd/erjB4GPu9w19NyoIskZClD github.com/Antonboom/errname v0.1.12/go.mod h1:bK7todrzvlaZoQagP1orKzWXv59X/x0W0Io2XT1Ssro= github.com/Antonboom/nilnil v0.1.7 h1:ofgL+BA7vlA1K2wNQOsHzLJ2Pw5B5DpWRLdDAVvvTow= github.com/Antonboom/nilnil v0.1.7/go.mod h1:TP+ScQWVEq0eSIxqU8CbdT5DFWoHp0MbP+KMUO1BKYQ= -github.com/Antonboom/testifylint v0.2.3 h1:MFq9zyL+rIVpsvLX4vDPLojgN7qODzWsrnftNX2Qh60= -github.com/Antonboom/testifylint v0.2.3/go.mod h1:IYaXaOX9NbfAyO+Y04nfjGI8wDemC1rUyM/cYolz018= +github.com/Antonboom/testifylint v1.1.2 h1:IdLRermiLRogxY5AumBL4sP0A+qKHQM/AP1Xd7XOTKc= +github.com/Antonboom/testifylint v1.1.2/go.mod h1:9PFi+vWa8zzl4/B/kqmFJcw85ZUv8ReyBzuQCd30+WI= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -60,8 +60,8 @@ github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwS github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 h1:3ZBs7LAezy8gh0uECsA6CGU43FF3zsx5f4eah5FxTMA= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0/go.mod h1:rZLTje5A9kFBe0pzhpe2TdhRniBF++PRHQuRpR8esVc= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 h1:sATXp1x6/axKxz2Gjxv8MALP0bXaNRfQinEwyfMcx8c= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0/go.mod h1:Nl76DrGNJTA1KJ0LePKBw/vznBX1EHbAZX8mwjR82nI= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= @@ -69,15 +69,15 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= -github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= -github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= +github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= +github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/go-check-sumtype v0.1.3 h1:M+tqMxB68hcgccRXBMVCPI4UJ+QUfdSx0xdbypKCqA8= -github.com/alecthomas/go-check-sumtype v0.1.3/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= +github.com/alecthomas/go-check-sumtype v0.1.4 h1:WCvlB3l5Vq5dZQTFmodqL2g68uHiSwwlWcT5a2FGK0c= +github.com/alecthomas/go-check-sumtype v0.1.4/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -91,8 +91,8 @@ github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pO github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis/v2 v2.31.0 h1:ObEFUNlJwoIiyjxdrYF0QIDE7qXcLc7D3WpSH4c22PU= -github.com/alicebob/miniredis/v2 v2.31.0/go.mod h1:UB/T2Uztp7MlFSDakaX1sTXUv5CASoprx0wulRT6HBg= +github.com/alicebob/miniredis/v2 v2.31.1 h1:7XAt0uUg3DtwEKW5ZAGa+K7FZV2DdKQo5K/6TTnfX8Y= +github.com/alicebob/miniredis/v2 v2.31.1/go.mod h1:UB/T2Uztp7MlFSDakaX1sTXUv5CASoprx0wulRT6HBg= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= @@ -122,8 +122,8 @@ github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2y github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= -github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= -github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= +github.com/bombsimon/wsl/v4 v4.2.1 h1:Cxg6u+XDWff75SIFFmNsqnIOgob+Q9hG6y/ioKbRFiM= +github.com/bombsimon/wsl/v4 v4.2.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= @@ -136,14 +136,14 @@ github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipus github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/butuzov/ireturn v0.2.2 h1:jWI36dxXwVrI+RnXDwux2IZOewpmfv930OuIRfaBUJ0= -github.com/butuzov/ireturn v0.2.2/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk= +github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0= +github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= -github.com/catenacyber/perfsprint v0.2.0 h1:azOocHLscPjqXVJ7Mf14Zjlkn4uNua0+Hcg1wTR6vUo= -github.com/catenacyber/perfsprint v0.2.0/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= -github.com/ccojocar/zxcvbn-go v1.0.1 h1:+sxrANSCj6CdadkcMnvde/GWU1vZiiXRbqYSCalV4/4= -github.com/ccojocar/zxcvbn-go v1.0.1/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= +github.com/catenacyber/perfsprint v0.6.0 h1:VSv95RRkk5+BxrU/YTPcnxuMEWar1iMK5Vyh3fWcBfs= +github.com/catenacyber/perfsprint v0.6.0/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= +github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= +github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= @@ -201,8 +201,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/daixiang0/gci v0.11.2 h1:Oji+oPsp3bQ6bNNgX30NBAVT18P4uBH4sRZnlOlTj7Y= -github.com/daixiang0/gci v0.11.2/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= +github.com/daixiang0/gci v0.12.1 h1:ugsG+KRYny1VK4oqrX4Vtj70bo4akYKa0tgT1DXMYiY= +github.com/daixiang0/gci v0.12.1/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -245,19 +245,19 @@ github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStB github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.13.8 h1:1od+thJel3tM52ZUNQwvpYOeRHlbkVFZ5S8fhi0Lgsg= -github.com/ethereum/go-ethereum v1.13.8/go.mod h1:sc48XYQxCzH3fG9BcrXCOOgQk2JfZzNAmIKnceogzsA= -github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= -github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= +github.com/ethereum/go-ethereum v1.13.13 h1:KYn9w7pEWRI9oyZOzO94OVbctSusPByHdFDPj634jII= +github.com/ethereum/go-ethereum v1.13.13/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= +github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= +github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= +github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -270,18 +270,18 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqG github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= -github.com/getkin/kin-openapi v0.122.0 h1:WB9Jbl0Hp/T79/JF9xlSW5Kl9uYdk/AWD0yAd9HOM10= -github.com/getkin/kin-openapi v0.122.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= +github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= +github.com/getkin/kin-openapi v0.123.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/ghostiam/protogetter v0.2.3 h1:qdv2pzo3BpLqezwqfGDLZ+nHEYmc5bUpIdsMbBVwMjw= -github.com/ghostiam/protogetter v0.2.3/go.mod h1:KmNLOsy1v04hKbvZs8EfGI1fk39AgTdRDxWNYPfXVc4= +github.com/ghostiam/protogetter v0.3.4 h1:5SZ+lZSNmNkSbGVSF9hUHhv/b7ELF9Rwchoq7btYo6c= +github.com/ghostiam/protogetter v0.3.4/go.mod h1:A0JgIhs0fgVnotGinjQiKaFVG3waItLJNwPmcMzDnvk= github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= -github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczKGV/U= -github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= +github.com/go-critic/go-critic v0.11.1 h1:/zBseUSUMytnRqxjlsYNbDDxpu3R2yH8oLXo/FOE8b8= +github.com/go-critic/go-critic v0.11.1/go.mod h1:aZVQR7+gazH6aDEQx4356SD7d8ez8MipYjXbEl5JAKA= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= @@ -300,16 +300,15 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw= +github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI= github.com/go-redis/cache/v8 v8.4.4 h1:Rm0wZ55X22BA2JMqVtRQNHYyzDd0I5f+Ec/C9Xx3mXY= github.com/go-redis/cache/v8 v8.4.4/go.mod h1:JM6CkupsPvAu/LYEVGQy6UB4WDAzQSXkR0lUCbeIcKc= github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc= @@ -330,8 +329,9 @@ github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4 github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= -github.com/go-toolsmith/astequal v1.1.0 h1:kHKm1AWqClYn15R0K1KKE4RG614D46n+nqUQ06E1dTw= github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= +github.com/go-toolsmith/astequal v1.2.0 h1:3Fs3CYZ1k9Vo4FzFhwwewC3CHISHDnVUPC4x0bI2+Cw= +github.com/go-toolsmith/astequal v1.2.0/go.mod h1:c8NZ3+kSFtFY/8lPso4v8LuJjdJiUFVnSuU3s0qrrDY= github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsOmcco= github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= @@ -343,6 +343,8 @@ github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQi github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= +github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c= +github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -353,8 +355,6 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= -github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -404,8 +404,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.55.2 h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8= -github.com/golangci/golangci-lint v1.55.2/go.mod h1:H60CZ0fuqoTwlTvnbyjhpZPWp7KmsjwV2yupIMiMXbM= +github.com/golangci/golangci-lint v1.56.2 h1:dgQzlWHgNbCqJjuxRJhFEnHDVrrjuTGQHJ3RIZMpp/o= +github.com/golangci/golangci-lint v1.56.2/go.mod h1:7CfNO675+EY7j84jihO4iAqDQ80s3HCjcc5M6B7SlZQ= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -451,12 +451,12 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 h1:mrEEilTAUmaAORhssPPkxj84TsHrPMLBGW2Z4SoTxm8= -github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gordonklaus/ineffassign v0.1.0 h1:y2Gd/9I7MdY1oEIt+n+rowjBNDcLQq3RsH5hwJd0f9s= +github.com/gordonklaus/ineffassign v0.1.0/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= @@ -513,8 +513,8 @@ github.com/hashicorp/vault/api/auth/userpass v0.5.0 h1:u//BC15YJviWSpeTlxsmt96FP github.com/hashicorp/vault/api/auth/userpass v0.5.0/go.mod h1:TNxl3X6ZaeILi1rfxP/mhGnWuiCiP7SNv2qeZ5aSAMQ= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= -github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= @@ -529,18 +529,18 @@ github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48/go.mod h1:kJmVPMk4HfWyl2kcta34aad/K4TAfCwB29xX9PsR7LQ= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f h1:aTYEBIh802oWF6B3jhXf5F7UVGxfPJG70shYkRXzb+s= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= -github.com/iden3/go-circuits/v2 v2.0.0 h1:Bw0mpsqeip06d6I2ktgfhTVB7Jk9mSHi8myHZWkoc6w= -github.com/iden3/go-circuits/v2 v2.0.0/go.mod h1:VIFIp51+IH0hOzjnKhb84bCeyq7hq76zX/C14ua6zh4= -github.com/iden3/go-iden3-auth/v2 v2.0.0 h1:DMrnmBY2lGhLjI6jLK2AE42FMIlgQc+vbeM+fW79Ge4= -github.com/iden3/go-iden3-auth/v2 v2.0.0/go.mod h1:bYr47aev7sh23RL7Ru+TQQSlYDS94+wO8P8SDrwdifc= +github.com/iden3/go-circuits/v2 v2.0.1 h1:tcJtBE8aLJsf9qpBoTUKE143Mne025cunQnSExMXaKo= +github.com/iden3/go-circuits/v2 v2.0.1/go.mod h1:VIFIp51+IH0hOzjnKhb84bCeyq7hq76zX/C14ua6zh4= +github.com/iden3/go-iden3-auth/v2 v2.1.0 h1:e+oRhPyJ14dbwDjAnYrp1O+PvtzzzhOLxLqFnqkoekE= +github.com/iden3/go-iden3-auth/v2 v2.1.0/go.mod h1:KpKzSa5ANat+mSMTUzBZwQZ5NTI6w8Q4L0yVxQdnyVc= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= -github.com/iden3/go-iden3-core/v2 v2.0.3 h1:ce9Jbw10zDsinWXFc05SiK2Hof/wu4zV4/ai5gQy29k= -github.com/iden3/go-iden3-core/v2 v2.0.3/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= -github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= -github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= -github.com/iden3/go-jwz/v2 v2.0.0 h1:VsU2PrmcchPMx/V0IhamMZRNjiQYZoyJopO8K8uSZOY= -github.com/iden3/go-jwz/v2 v2.0.0/go.mod h1:JBJ58Cef8h+4Uz8qaVRsNjiT/Ubqb800dGKTZt66NkU= +github.com/iden3/go-iden3-core/v2 v2.0.4 h1:ggzC2zgOWgJAAcuG9X8bQG1r4gAoHZWqY7aLV8b1qgc= +github.com/iden3/go-iden3-core/v2 v2.0.4/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= +github.com/iden3/go-iden3-crypto v0.0.16 h1:zN867xiz6HgErXVIV/6WyteGcOukE9gybYTorBMEdsk= +github.com/iden3/go-iden3-crypto v0.0.16/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= +github.com/iden3/go-jwz/v2 v2.0.1 h1:y8HccYGaI5JULVTOfKRPsQ2pGRx8pfgkdCz0kQA8jQE= +github.com/iden3/go-jwz/v2 v2.0.1/go.mod h1:+DRKSnFk3IsDvcKZA5EDeJFOSxjXm1kWAp588Kf+FN8= github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 h1:CKry110riXxBu1bM9vhdPia37tlbqoKYg0s0dwGA4l4= github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5/go.mod h1:J17cXiT4pBP/c5FWN4nv0J7q2yT9I8JSzUfdIKyZIj4= github.com/iden3/go-merkletree-sql/v2 v2.0.6 h1:vsVDImnvnHf7Ggr45ptFOXJyWNA/8IwVQO1jzRLUlY8= @@ -557,12 +557,12 @@ github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e/go.mod h1:UEBifEzw62T6VzIHJeHuUgeLg2U/J9ttf7hOwQEqnYk= github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFLPTEqnOIvlM= github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= -github.com/iden3/go-schema-processor/v2 v2.2.0 h1:sYPqLs72pEWXIfF0/MOv9AFm3+IGutRM3yClWRrjheg= -github.com/iden3/go-schema-processor/v2 v2.2.0/go.mod h1:Ovsrk0839NZgHtoW4hVLAmHoOsHAQZuVNUXd7sIOkLQ= -github.com/iden3/iden3comm/v2 v2.0.0 h1:cFDfF6aJ589ENg5zlTBEPK6Qqv4I11C/gliAWZORpyY= -github.com/iden3/iden3comm/v2 v2.0.0/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= -github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= -github.com/iden3/merkletree-proof v0.0.4/go.mod h1:D49CVDG/tshMiZuDCxWjGJoNplRg9y9XIlg9/eMSYOc= +github.com/iden3/go-schema-processor/v2 v2.3.1 h1:cjsfUZNgyPoHQDEES4vuVod948QC9l35QkoEIat0ghc= +github.com/iden3/go-schema-processor/v2 v2.3.1/go.mod h1:BcHVDZyn8q8vUlL+XpOo7hpwXmEjxzO8ao1LkvFsM+k= +github.com/iden3/iden3comm/v2 v2.2.0 h1:cftP0uP8+/1+9r/Fin1FDbSDZuqIoXZv+EITw3/bS5Q= +github.com/iden3/iden3comm/v2 v2.2.0/go.mod h1:IBdraWsFyChVTArxaE2zr4ALhw7eetJFpEukj2qimeg= +github.com/iden3/merkletree-proof v0.1.0 h1:AHmpkbCTLKv1MWWt6YwogB65E4y6UZthbZYPed81w4U= +github.com/iden3/merkletree-proof v0.1.0/go.mod h1:ul0HDU6/eVNX++u/PWScY7pTXiFjqM5kA6vl1wEoTUU= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -632,12 +632,14 @@ github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jgautheron/goconst v1.6.0 h1:gbMLWKRMkzAc6kYsQL6/TxaoBUg3Jm9LSF/Ih1ADWGA= -github.com/jgautheron/goconst v1.6.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= +github.com/jgautheron/goconst v1.7.0 h1:cEqH+YBKLsECnRSd4F4TK5ri8t/aXtt/qoL0Ft252B0= +github.com/jgautheron/goconst v1.7.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= +github.com/jjti/go-spancheck v0.5.2 h1:WXTZG3efY/ji1Vi8mkH+23O3bLeKR6hp3tI3YB7XwKk= +github.com/jjti/go-spancheck v0.5.2/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= @@ -663,8 +665,8 @@ github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSX github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= -github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= +github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= +github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= @@ -679,7 +681,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -690,8 +691,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= -github.com/kunwardeep/paralleltest v1.0.8 h1:Ul2KsqtzFxTlSU7IP0JusWlLiNqQaloB9vguyjbE558= -github.com/kunwardeep/paralleltest v1.0.8/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= +github.com/kunwardeep/paralleltest v1.0.9 h1:3Sr2IfFNcsMmlqPk1cjTUbJ4zofKPGyHxenwPebgTug= +github.com/kunwardeep/paralleltest v1.0.9/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= @@ -733,8 +734,8 @@ github.com/libp2p/go-libp2p v0.32.2 h1:s8GYN4YJzgUoyeYNPdW7JZeZ5Ee31iNaIBfGYMAY4 github.com/libp2p/go-libp2p v0.32.2/go.mod h1:E0LKe+diV/ZVJVnOJby8VC5xzHF0660osg71skcxJvk= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/macabu/inamedparam v0.1.2 h1:RR5cnayM6Q7cDhQol32DE2BGAPGMnffJ31LFE+UklaU= -github.com/macabu/inamedparam v0.1.2/go.mod h1:Xg25QvY7IBRl1KLPV9Rbml8JOMZtF/iAkNkmV7eQgjw= +github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= +github.com/macabu/inamedparam v0.1.3/go.mod h1:93FLICAIk/quk7eaPPQvbzihUdn/QkGDwIZEoLtpH6I= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -772,8 +773,8 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvls github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/revive v1.3.4 h1:k/tO3XTaWY4DEHal9tWBkkUMJYO/dLDVyMmAQxmIMDc= -github.com/mgechev/revive v1.3.4/go.mod h1:W+pZCMu9qj8Uhfs1iJMQsEFLRozUfvwFwqVvRbSNLVw= +github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= +github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -821,17 +822,17 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= -github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= -github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= +github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhKRf3Swg= +github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.14.1 h1:khx0CqR5U4ghsscjJ+lZVthp3zjIFytRXPTaQ/TMiyA= -github.com/nunnatsa/ginkgolinter v0.14.1/go.mod h1:nY0pafUSst7v7F637e7fymaMlQqI9c0Wka2fGsDkzWg= +github.com/nunnatsa/ginkgolinter v0.15.2 h1:N2ORxUxPU56R9gsfLIlVVvCv/V/VVou5qVI1oBKBNHg= +github.com/nunnatsa/ginkgolinter v0.15.2/go.mod h1:oYxE7dt1vZI8cK2rZOs3RgTaBN2vggkqnENmoJ8kVvc= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oapi-codegen/runtime v1.1.0 h1:rJpoNUawn5XTvekgfkvSZr0RqEnoYpFkyvrzfWeFKWM= -github.com/oapi-codegen/runtime v1.1.0/go.mod h1:BeSfBkWWWnAnGdyS+S/GnlbmHKzf8/hwkvelJZDeKA8= +github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= +github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/olomix/go-test-pg v1.0.2 h1:4ey3mFBhPx93PdgyshOJI1WrQzqzkWEnb0wL/7UbFMI= @@ -842,13 +843,13 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= -github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= -github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= @@ -858,8 +859,8 @@ github.com/opencontainers/runc v1.1.10/go.mod h1:+/R6+KmDlh+hOO8NkjmgkG9Qzvypzk0 github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/copy v1.11.0 h1:OKBD80J/mLBrwnzXqGtFCzprFSGioo30JcmR4APsNwc= -github.com/otiai10/copy v1.11.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= +github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= +github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= @@ -886,8 +887,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.4.5 h1:70YWmMy4FgRHehGNOUask3HtSFSOLKgmDn7ryNe7LqI= -github.com/polyfloyd/go-errorlint v1.4.5/go.mod h1:sIZEbFoDOCnTYYZoVkjc4hTnM459tuWA9H/EkdXwsKk= +github.com/polyfloyd/go-errorlint v1.4.8 h1:jiEjKDH33ouFktyez7sckv6pHWif9B7SuS8cutDXFHw= +github.com/polyfloyd/go-errorlint v1.4.8/go.mod h1:NNCxFcFjZcw3xNjVdCchERkEM6Oz7wta2XJVxRftwO4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/pquerna/cachecontrol v0.2.0 h1:vBXSNuE5MYP9IJ5kjsdo8uq+w41jSPgvba2DEnkRx9k= github.com/pquerna/cachecontrol v0.2.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI= @@ -961,11 +962,11 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.24.0 h1:MKNzmXtGh5N0y74Z/CIaJh4GlB364l0K1RUT08WSWAc= -github.com/sashamelentyev/usestdlibvars v1.24.0/go.mod h1:9cYkq+gYJ+a5W2RPdhfaSCnTVUC1OQP/bSiiBhq3OZE= +github.com/sashamelentyev/usestdlibvars v1.25.0 h1:IK8SI2QyFzy/2OD2PYnhy84dpfNo9qADrRt6LH8vSzU= +github.com/sashamelentyev/usestdlibvars v1.25.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/securego/gosec/v2 v2.18.2 h1:DkDt3wCiOtAHf1XkiXZBhQ6m6mK/b9T/wD257R3/c+I= -github.com/securego/gosec/v2 v2.18.2/go.mod h1:xUuqSF6i0So56Y2wwohWAmB07EdBkUN6crbLlHwbyJs= +github.com/securego/gosec/v2 v2.19.0 h1:gl5xMkOI0/E6Hxx0XCY2XujA3V7SNSefA8sC+3f1gnk= +github.com/securego/gosec/v2 v2.19.0/go.mod h1:hOkDcHz9J/XIgIlPDXalxjeVYsHxoWUc5zJSHxcB8YM= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/sethvargo/go-retry v0.2.4 h1:T+jHEQy/zKJf5s95UkguisicE0zuF9y7+/vgz08Ocec= @@ -1048,8 +1049,8 @@ github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.15 h1:QzdIs+XB8q+U1WmQEWKHQbKmCw06QuQM7gLx/dky2RM= -github.com/tetafro/godot v1.4.15/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= +github.com/tetafro/godot v1.4.16 h1:4ChfhveiNLk4NveAZ9Pu2AN8QZ2nkUGFuadM9lrr5D0= +github.com/tetafro/godot v1.4.16/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= github.com/tetratelabs/wazero v1.6.0 h1:z0H1iikCdP8t+q341xqepY4EWvHEw8Es7tlqiVzlP3g= github.com/tetratelabs/wazero v1.6.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= @@ -1070,8 +1071,8 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= -github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= -github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= +github.com/ultraware/whitespace v0.1.0 h1:O1HKYoh0kIeqE8sFqZf1o0qbORXUCOQFrlaQyZsczZw= +github.com/ultraware/whitespace v0.1.0/go.mod h1:/se4r3beMFNmewJ4Xmz0nMQ941GJt+qmSHGP9emHYe0= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= @@ -1107,8 +1108,8 @@ github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2 h1:E0yUuuX7UmPxXm92+yQCjMveLFO3zfv github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2/go.mod h1:fjBLQ2TdQNl4bMjuWl9adoTGBypwUTPoGC+EqYqiIcU= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= -github.com/ykadowak/zerologlint v0.1.3 h1:TLy1dTW3Nuc+YE3bYRPToG1Q9Ej78b5UUN6bjbGdxPE= -github.com/ykadowak/zerologlint v0.1.3/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= +github.com/ykadowak/zerologlint v0.1.5 h1:Gy/fMz1dFQN9JZTPjv1hxEk+sRWm05row04Yoolgdiw= +github.com/ykadowak/zerologlint v0.1.5/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1123,10 +1124,12 @@ github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= gitlab.com/bosi/decorder v0.4.1 h1:VdsdfxhstabyhZovHafFw+9eJ6eU0d2CkFNJcZz/NU4= gitlab.com/bosi/decorder v0.4.1/go.mod h1:jecSqWUew6Yle1pCr2eLWTensJMmsxHsBwt+PVbkAqA= -go-simpler.org/assert v0.6.0 h1:QxSrXa4oRuo/1eHMXSBFHKvJIpWABayzKldqZyugG7E= -go-simpler.org/assert v0.6.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= -go-simpler.org/sloglint v0.1.2 h1:IjdhF8NPxyn0Ckn2+fuIof7ntSnVUAqBFcQRrnG9AiM= -go-simpler.org/sloglint v0.1.2/go.mod h1:2LL+QImPfTslD5muNPydAEYmpXIj6o/WYcqnJjLi4o4= +go-simpler.org/assert v0.7.0 h1:OzWWZqfNxt8cLS+MlUp6Tgk1HjPkmgdKBq9qvy8lZsA= +go-simpler.org/assert v0.7.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= +go-simpler.org/musttag v0.8.0 h1:DR4UTgetNNhPRNo02rkK1hwDTRzAPotN+ZqYpdtEwWc= +go-simpler.org/musttag v0.8.0/go.mod h1:fiNdCkXt2S6je9Eblma3okjnlva9NT1Eg/WUt19rWu8= +go-simpler.org/sloglint v0.4.0 h1:UVJuUJo63iNQNFEOtZ6o1xAgagVg/giVLLvG9nNLobI= +go-simpler.org/sloglint v0.4.0/go.mod h1:v6zJ++j/thFPhefs2wEXoCKwT10yo5nkBDYRCXyqgNQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -1136,8 +1139,6 @@ go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= -go.tmz.dev/musttag v0.7.2 h1:1J6S9ipDbalBSODNT5jCep8dhZyMr4ttnjQagmGYR5s= -go.tmz.dev/musttag v0.7.2/go.mod h1:m6q5NiiSKMnQYokefa2xGoyoXnrswCbJ0AWYzf4Zs28= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1171,8 +1172,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1183,12 +1184,12 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4= -golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= -golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 h1:UhRVJ0i7bF9n/Hd8YjW3eKjlPVBHzbQdxrBgjbSKl64= +golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1219,8 +1220,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1266,8 +1267,8 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1287,8 +1288,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1361,8 +1362,9 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1462,8 +1464,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1613,14 +1615,14 @@ modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E= -mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js= +mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= +mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w= -mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= +mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 h1:zCr3iRRgdk5eIikZNDphGcM6KGVTx3Yu+/Uu9Es254w= +mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From a907436f38059f198074b06f4c75d25028655b63 Mon Sep 17 00:00:00 2001 From: x1m3 Date: Mon, 26 Feb 2024 12:05:49 +0100 Subject: [PATCH 080/110] chore: Use right iden3 libs --- go.mod | 6 +++--- go.sum | 8 ++++++-- internal/core/services/claims.go | 3 --- internal/core/services/identity.go | 1 - internal/gateways/publisher.go | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index f1cbd3334..92df6a5ad 100644 --- a/go.mod +++ b/go.mod @@ -30,9 +30,9 @@ require ( github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 - github.com/iden3/go-schema-processor/v2 v2.3.1 - github.com/iden3/iden3comm/v2 v2.2.0 - github.com/iden3/merkletree-proof v0.1.0 + github.com/iden3/go-schema-processor/v2 v2.2.0 + github.com/iden3/iden3comm/v2 v2.1.0 + github.com/iden3/merkletree-proof v0.0.4 github.com/ipfs/go-ipfs-api v0.7.0 github.com/jackc/pgconn v1.14.1 github.com/jackc/pgtype v1.14.0 diff --git a/go.sum b/go.sum index bc5201c52..a690d197f 100644 --- a/go.sum +++ b/go.sum @@ -557,12 +557,16 @@ github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e/go.mod h1:UEBifEzw62T6VzIHJeHuUgeLg2U/J9ttf7hOwQEqnYk= github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFLPTEqnOIvlM= github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= +github.com/iden3/go-schema-processor/v2 v2.2.0 h1:sYPqLs72pEWXIfF0/MOv9AFm3+IGutRM3yClWRrjheg= +github.com/iden3/go-schema-processor/v2 v2.2.0/go.mod h1:Ovsrk0839NZgHtoW4hVLAmHoOsHAQZuVNUXd7sIOkLQ= github.com/iden3/go-schema-processor/v2 v2.3.1 h1:cjsfUZNgyPoHQDEES4vuVod948QC9l35QkoEIat0ghc= github.com/iden3/go-schema-processor/v2 v2.3.1/go.mod h1:BcHVDZyn8q8vUlL+XpOo7hpwXmEjxzO8ao1LkvFsM+k= +github.com/iden3/iden3comm/v2 v2.1.0 h1:op2X3y/H9khizcdoYKf3iRAQFt/l5dsip47sJu1kv7Q= +github.com/iden3/iden3comm/v2 v2.1.0/go.mod h1:G+ufR/M28O3PKMVrkUqCuoYfjiEkGFWvf8oF2BmFC6c= github.com/iden3/iden3comm/v2 v2.2.0 h1:cftP0uP8+/1+9r/Fin1FDbSDZuqIoXZv+EITw3/bS5Q= github.com/iden3/iden3comm/v2 v2.2.0/go.mod h1:IBdraWsFyChVTArxaE2zr4ALhw7eetJFpEukj2qimeg= -github.com/iden3/merkletree-proof v0.1.0 h1:AHmpkbCTLKv1MWWt6YwogB65E4y6UZthbZYPed81w4U= -github.com/iden3/merkletree-proof v0.1.0/go.mod h1:ul0HDU6/eVNX++u/PWScY7pTXiFjqM5kA6vl1wEoTUU= +github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= +github.com/iden3/merkletree-proof v0.0.4/go.mod h1:D49CVDG/tshMiZuDCxWjGJoNplRg9y9XIlg9/eMSYOc= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 524000838..69e8c0ec6 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -534,7 +534,6 @@ func (c *claim) UpdateClaimsMTPAndState(ctx context.Context, currentState *domai return fmt.Errorf("failed set mtp proof: %w", err) } affected, err = c.icRepo.UpdateClaimMTP(ctx, c.storage.Pgx, &claims[i]) - if err != nil { return fmt.Errorf("can't update claim mtp: %w", err) } @@ -576,7 +575,6 @@ func (c *claim) revoke(ctx context.Context, did *w3c.DID, nonce uint64, descript var claims []*domain.Claim claims, err = c.icRepo.GetByRevocationNonce(ctx, querier, did, domain.RevNonceUint64(nonce)) - if err != nil { if errors.Is(err, repositories.ErrClaimDoesNotExist) { return err @@ -597,7 +595,6 @@ func (c *claim) revoke(ctx context.Context, did *w3c.DID, nonce uint64, descript return c.icRepo.RevokeNonce(ctx, tx, &revocation) }) - if err != nil { log.Error(ctx, "error saving the revoked claims", "err", err) return err diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index cfb4075e4..d1ffa13d7 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -130,7 +130,6 @@ func (i *identity) Create(ctx context.Context, hostURL string, didOptions *ports } return err }) - if err != nil { log.Error(ctx, "creating identity", "err", err, "id", identifier) return nil, fmt.Errorf("cannot create identity: %w", err) diff --git a/internal/gateways/publisher.go b/internal/gateways/publisher.go index 0ecdc0dc4..0ba60ded2 100644 --- a/internal/gateways/publisher.go +++ b/internal/gateways/publisher.go @@ -387,7 +387,6 @@ func (p *publisher) fillAuthClaimData(ctx context.Context, identifier *w3c.DID, return errIn }) - if err != nil { return nil, nil, err } From 27949ef8c3f3a6ab05fc01a53775859822e97370 Mon Sep 17 00:00:00 2001 From: Ilya Date: Tue, 27 Feb 2024 12:14:56 +0200 Subject: [PATCH 081/110] register custom network --- cmd/platform/main.go | 15 +++++++++++ internal/config/config.go | 52 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/cmd/platform/main.go b/cmd/platform/main.go index b6dd86c2f..f1319356f 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -14,6 +14,7 @@ import ( "github.com/go-chi/cors" redis2 "github.com/go-redis/redis/v8" vault "github.com/hashicorp/vault/api" + core "github.com/iden3/go-iden3-core/v2" "github.com/polygonid/sh-id-platform/internal/api" "github.com/polygonid/sh-id-platform/internal/buildinfo" @@ -53,6 +54,8 @@ func main() { return } + registerCustomNetworks(cfg) + log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) if err := cfg.Sanitize(ctx); err != nil { @@ -229,3 +232,15 @@ func middlewares(ctx context.Context, auth config.HTTPBasicAuth) []api.StrictMid api.BasicAuthMiddleware(ctx, auth.User, auth.Password), } } + +func registerCustomNetworks(cfg *config.Configuration) { + for _, network := range cfg.CustomNetworks { + params := core.DIDMethodNetworkParams{ + Method: core.DIDMethodPolygonID, + Blockchain: core.Blockchain(network.Blockchain), + Network: core.NetworkID(network.Network), + NetworkFlag: network.NetworkFlag, + } + core.RegisterDIDMethodNetwork(params, core.WithChainID(network.ChainID)) + } +} diff --git a/internal/config/config.go b/internal/config/config.go index a6889e3b6..6b1839c7c 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -2,6 +2,7 @@ package config import ( "context" + "encoding/json" "errors" "fmt" "net/url" @@ -9,6 +10,7 @@ import ( "path/filepath" "regexp" "runtime" + "strconv" "strings" "time" @@ -47,6 +49,7 @@ type Configuration struct { VaultUserPassAuthEnabled bool VaultUserPassAuthPassword string CredentialStatus CredentialStatus `mapstructure:"CredentialStatus"` + CustomNetworks []CustomNetwork `mapstructure:"-"` } // Database has the database configuration @@ -90,6 +93,42 @@ type Ethereum struct { TransferAccountKeyPath string `tip:"Transfer account key path"` } +// CustomNetwork struct +type CustomNetwork struct { + Blockchain string `tip:"Identity blockchain for custom network"` + Network string `tip:"Identity network for custom network"` + NetworkFlag byte `tip:"Identity network flag for custom network"` + ChainID int `tip:"Chain id for custom network"` +} + +// UnmarshalJSON implements the Unmarshal interface for CustomNetwork +func (cn *CustomNetwork) UnmarshalJSON(data []byte) error { + aux := struct { + Blockchain string `json:"blockchain"` + Network string `json:"network"` + NetworkFlag string `json:"networkFlag"` + ChainID int `json:"chainId"` + }{} + + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if len(aux.NetworkFlag) != 10 || aux.NetworkFlag[:2] != "0b" { + return errors.New("invalid NetworkFlag format") + } + flag, err := strconv.ParseUint(aux.NetworkFlag[2:], 2, 8) + if err != nil { + return err + } + + cn.Blockchain = aux.Blockchain + cn.Network = aux.Network + cn.NetworkFlag = byte(flag) + cn.ChainID = aux.ChainID + + return nil +} + // Prover struct type Prover struct { ServerURL string @@ -344,6 +383,17 @@ func Load(fileName string) (*Configuration, error) { if err := viper.Unmarshal(config); err != nil { log.Error(ctx, "error unmarshalling configuration", "err", err) } + + jsonStr := viper.GetString("CUSTOM_NETWORKS") + var customNetworks []CustomNetwork + if jsonStr != "" { + if err := json.Unmarshal([]byte(jsonStr), &customNetworks); err != nil { + log.Error(ctx, "error unmarshalling custom networks", "err", err) + return nil, err + } + } + config.CustomNetworks = customNetworks + checkEnvVars(ctx, config) return config, nil } @@ -452,6 +502,8 @@ func bindEnv() { _ = viper.BindEnv("APIUI.IdentityNetwork", "ISSUER_API_IDENTITY_NETWORK") _ = viper.BindEnv("APIUI.KeyType", "ISSUER_API_UI_KEY_TYPE") + _ = viper.BindEnv("ISSUER_CUSTOM_NETWORKS") + viper.AutomaticEnv() } From 376291c76e1922aed42f030100bdd9c1de8632c6 Mon Sep 17 00:00:00 2001 From: Ilya Date: Tue, 27 Feb 2024 12:20:48 +0200 Subject: [PATCH 082/110] to use example --- internal/config/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/config/config.go b/internal/config/config.go index 6b1839c7c..203a5efd0 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -94,6 +94,7 @@ type Ethereum struct { } // CustomNetwork struct +// Example: ISSUER_CUSTOM_NETWORKS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' type CustomNetwork struct { Blockchain string `tip:"Identity blockchain for custom network"` Network string `tip:"Identity network for custom network"` From da2f1e7108e29ebdaebc6745ea4d36fb588f2862 Mon Sep 17 00:00:00 2001 From: Ilya Date: Tue, 27 Feb 2024 13:03:10 +0200 Subject: [PATCH 083/110] rename CustomNetworks to CustomDIDMethods --- cmd/platform/main.go | 6 +++--- internal/config/config.go | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/platform/main.go b/cmd/platform/main.go index f1319356f..688f327a1 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -54,7 +54,7 @@ func main() { return } - registerCustomNetworks(cfg) + registerCustomDIDMethods(cfg) log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) @@ -233,8 +233,8 @@ func middlewares(ctx context.Context, auth config.HTTPBasicAuth) []api.StrictMid } } -func registerCustomNetworks(cfg *config.Configuration) { - for _, network := range cfg.CustomNetworks { +func registerCustomDIDMethods(cfg *config.Configuration) { + for _, network := range cfg.CustomDIDMethods { params := core.DIDMethodNetworkParams{ Method: core.DIDMethodPolygonID, Blockchain: core.Blockchain(network.Blockchain), diff --git a/internal/config/config.go b/internal/config/config.go index 203a5efd0..3299706d1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -48,8 +48,8 @@ type Configuration struct { IPFS IPFS `mapstructure:"IPFS"` VaultUserPassAuthEnabled bool VaultUserPassAuthPassword string - CredentialStatus CredentialStatus `mapstructure:"CredentialStatus"` - CustomNetworks []CustomNetwork `mapstructure:"-"` + CredentialStatus CredentialStatus `mapstructure:"CredentialStatus"` + CustomDIDMethods []CustomDIDMethods `mapstructure:"-"` } // Database has the database configuration @@ -93,9 +93,9 @@ type Ethereum struct { TransferAccountKeyPath string `tip:"Transfer account key path"` } -// CustomNetwork struct -// Example: ISSUER_CUSTOM_NETWORKS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' -type CustomNetwork struct { +// CustomDIDMethods struct +// Example: ISSUER_CUSTOM_DID_METHODS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' +type CustomDIDMethods struct { Blockchain string `tip:"Identity blockchain for custom network"` Network string `tip:"Identity network for custom network"` NetworkFlag byte `tip:"Identity network flag for custom network"` @@ -103,7 +103,7 @@ type CustomNetwork struct { } // UnmarshalJSON implements the Unmarshal interface for CustomNetwork -func (cn *CustomNetwork) UnmarshalJSON(data []byte) error { +func (cn *CustomDIDMethods) UnmarshalJSON(data []byte) error { aux := struct { Blockchain string `json:"blockchain"` Network string `json:"network"` @@ -385,15 +385,15 @@ func Load(fileName string) (*Configuration, error) { log.Error(ctx, "error unmarshalling configuration", "err", err) } - jsonStr := viper.GetString("CUSTOM_NETWORKS") - var customNetworks []CustomNetwork + jsonStr := viper.GetString("CUSTOM_DID_METHODS") + var customDIDMethods []CustomDIDMethods if jsonStr != "" { - if err := json.Unmarshal([]byte(jsonStr), &customNetworks); err != nil { + if err := json.Unmarshal([]byte(jsonStr), &customDIDMethods); err != nil { log.Error(ctx, "error unmarshalling custom networks", "err", err) return nil, err } } - config.CustomNetworks = customNetworks + config.CustomDIDMethods = customDIDMethods checkEnvVars(ctx, config) return config, nil @@ -503,7 +503,7 @@ func bindEnv() { _ = viper.BindEnv("APIUI.IdentityNetwork", "ISSUER_API_IDENTITY_NETWORK") _ = viper.BindEnv("APIUI.KeyType", "ISSUER_API_UI_KEY_TYPE") - _ = viper.BindEnv("ISSUER_CUSTOM_NETWORKS") + _ = viper.BindEnv("ISSUER_CUSTOM_DID_METHODS") viper.AutomaticEnv() } From ea7c1950da1f258c7aa5d4d132905001f0ecf04b Mon Sep 17 00:00:00 2001 From: Ilya Date: Tue, 27 Feb 2024 13:38:39 +0200 Subject: [PATCH 084/110] fix comments --- .env-api.sample | 1 + README.md | 6 ++++++ cmd/issuer_initializer/main.go | 2 ++ cmd/platform/main.go | 15 +-------------- cmd/platform_ui/main.go | 2 ++ go.sum | 6 ++---- internal/core/services/did_registrator.go | 19 +++++++++++++++++++ 7 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 internal/core/services/did_registrator.go diff --git a/.env-api.sample b/.env-api.sample index c2bd232c1..b1df75213 100644 --- a/.env-api.sample +++ b/.env-api.sample @@ -11,3 +11,4 @@ ISSUER_API_IDENTITY_BLOCKCHAIN=polygon ISSUER_API_IDENTITY_NETWORK=mumbai ISSUER_API_UI_KEY_TYPE=BJJ ISSUER_API_ENVIRONMENT=local +ISSUER_CUSTOM_DID_METHODS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' diff --git a/README.md b/README.md index 3ea8f1a78..98d99b8f2 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,12 @@ In order to make the UI work, we will need configure some env variables in the ` ISSUER_API_UI_SERVER_URL={PUBLICLY_ACCESSIBLE_URL_POINTING_TO_ISSUER_API_UI_SERVER_PORT} ``` + > **_NOTE:_** It is possible to register custom did methods. This field accepts an array of objects in JSON format.
+ > Example: + ``` + ISSUER_CUSTOM_DID_METHODS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' + ``` + 2. Generate Issuer DID: ```bash diff --git a/cmd/issuer_initializer/main.go b/cmd/issuer_initializer/main.go index df808e3a5..ae72ecdd8 100644 --- a/cmd/issuer_initializer/main.go +++ b/cmd/issuer_initializer/main.go @@ -47,6 +47,8 @@ func main() { log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) + services.RegisterCustomDIDMethods(cfg.CustomDIDMethods) + if err := cfg.Sanitize(ctx); err != nil { log.Error(ctx, "there are errors in the configuration that prevent server to start", "err", err) return diff --git a/cmd/platform/main.go b/cmd/platform/main.go index 688f327a1..a4c71faec 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -14,7 +14,6 @@ import ( "github.com/go-chi/cors" redis2 "github.com/go-redis/redis/v8" vault "github.com/hashicorp/vault/api" - core "github.com/iden3/go-iden3-core/v2" "github.com/polygonid/sh-id-platform/internal/api" "github.com/polygonid/sh-id-platform/internal/buildinfo" @@ -54,7 +53,7 @@ func main() { return } - registerCustomDIDMethods(cfg) + services.RegisterCustomDIDMethods(cfg.CustomDIDMethods) log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) @@ -232,15 +231,3 @@ func middlewares(ctx context.Context, auth config.HTTPBasicAuth) []api.StrictMid api.BasicAuthMiddleware(ctx, auth.User, auth.Password), } } - -func registerCustomDIDMethods(cfg *config.Configuration) { - for _, network := range cfg.CustomDIDMethods { - params := core.DIDMethodNetworkParams{ - Method: core.DIDMethodPolygonID, - Blockchain: core.Blockchain(network.Blockchain), - Network: core.NetworkID(network.Network), - NetworkFlag: network.NetworkFlag, - } - core.RegisterDIDMethodNetwork(params, core.WithChainID(network.ChainID)) - } -} diff --git a/cmd/platform_ui/main.go b/cmd/platform_ui/main.go index 00c1cd3e7..bc23db889 100644 --- a/cmd/platform_ui/main.go +++ b/cmd/platform_ui/main.go @@ -67,6 +67,8 @@ func main() { return } + services.RegisterCustomDIDMethods(cfg.CustomDIDMethods) + storage, err := db.NewStorage(cfg.Database.URL) if err != nil { log.Error(ctx, "cannot connect to database", "err", err) diff --git a/go.sum b/go.sum index a690d197f..458002efe 100644 --- a/go.sum +++ b/go.sum @@ -355,6 +355,8 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -559,12 +561,8 @@ github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFL github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= github.com/iden3/go-schema-processor/v2 v2.2.0 h1:sYPqLs72pEWXIfF0/MOv9AFm3+IGutRM3yClWRrjheg= github.com/iden3/go-schema-processor/v2 v2.2.0/go.mod h1:Ovsrk0839NZgHtoW4hVLAmHoOsHAQZuVNUXd7sIOkLQ= -github.com/iden3/go-schema-processor/v2 v2.3.1 h1:cjsfUZNgyPoHQDEES4vuVod948QC9l35QkoEIat0ghc= -github.com/iden3/go-schema-processor/v2 v2.3.1/go.mod h1:BcHVDZyn8q8vUlL+XpOo7hpwXmEjxzO8ao1LkvFsM+k= github.com/iden3/iden3comm/v2 v2.1.0 h1:op2X3y/H9khizcdoYKf3iRAQFt/l5dsip47sJu1kv7Q= github.com/iden3/iden3comm/v2 v2.1.0/go.mod h1:G+ufR/M28O3PKMVrkUqCuoYfjiEkGFWvf8oF2BmFC6c= -github.com/iden3/iden3comm/v2 v2.2.0 h1:cftP0uP8+/1+9r/Fin1FDbSDZuqIoXZv+EITw3/bS5Q= -github.com/iden3/iden3comm/v2 v2.2.0/go.mod h1:IBdraWsFyChVTArxaE2zr4ALhw7eetJFpEukj2qimeg= github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= github.com/iden3/merkletree-proof v0.0.4/go.mod h1:D49CVDG/tshMiZuDCxWjGJoNplRg9y9XIlg9/eMSYOc= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= diff --git a/internal/core/services/did_registrator.go b/internal/core/services/did_registrator.go new file mode 100644 index 000000000..9462795d2 --- /dev/null +++ b/internal/core/services/did_registrator.go @@ -0,0 +1,19 @@ +package services + +import ( + core "github.com/iden3/go-iden3-core/v2" + "github.com/polygonid/sh-id-platform/internal/config" +) + +// RegisterCustomDIDMethods registers custom DID methods +func RegisterCustomDIDMethods(customdDids []config.CustomDIDMethods) { + for _, cdid := range customdDids { + params := core.DIDMethodNetworkParams{ + Method: core.DIDMethodPolygonID, + Blockchain: core.Blockchain(cdid.Blockchain), + Network: core.NetworkID(cdid.Network), + NetworkFlag: cdid.NetworkFlag, + } + core.RegisterDIDMethodNetwork(params, core.WithChainID(cdid.ChainID)) + } +} From f630bf2db2c6679d453384bc7ca46279ea7442eb Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 28 Feb 2024 11:35:12 +0100 Subject: [PATCH 085/110] chore: Fix connections pagination by removing joins with credentials and schemas tables. --- cmd/notifications/main.go | 3 +- cmd/platform_ui/main.go | 2 +- internal/api_ui/responses.go | 6 +- internal/api_ui/server_test.go | 72 ++++---- internal/core/ports/claims_repository.go | 1 + internal/core/ports/connections_repository.go | 3 +- internal/core/ports/connections_service.go | 2 +- internal/core/services/connections.go | 29 +++- .../core/services/tests/notification_test.go | 2 +- internal/repositories/claims.go | 131 +++++++-------- internal/repositories/connections.go | 155 ++---------------- .../repositories/tests/connections_test.go | 16 +- 12 files changed, 146 insertions(+), 276 deletions(-) diff --git a/cmd/notifications/main.go b/cmd/notifications/main.go index 14fedc2e7..8ba35b4d6 100644 --- a/cmd/notifications/main.go +++ b/cmd/notifications/main.go @@ -72,6 +72,7 @@ func main() { cachex := cache.NewRedisCache(rdb) connectionsRepository := repositories.NewConnections() + claimsRepository := repositories.NewClaims() var vaultCli *vault.Client var vaultErr error @@ -98,7 +99,7 @@ func main() { return } - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepository, storage) credentialsService, err := newCredentialsService(ctx, cfg, storage, cachex, ps, vaultCli) if err != nil { log.Error(ctx, "cannot initialize the credential service", "err", err) diff --git a/cmd/platform_ui/main.go b/cmd/platform_ui/main.go index 00c1cd3e7..1e09aafaa 100644 --- a/cmd/platform_ui/main.go +++ b/cmd/platform_ui/main.go @@ -173,7 +173,7 @@ func main() { identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, connectionsRepository, storage, verifier, sessionRepository, ps, cfg.CredentialStatus, rhsFactory, revocationStatusResolver) schemaService := services.NewSchema(schemaRepository, schemaLoader) claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.APIUI.ServerURL, ps, cfg.IPFS.GatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepository, storage) linkService := services.NewLinkService(storage, claimsService, qrService, claimsRepository, linkRepository, schemaRepository, schemaLoader, sessionRepository, ps, cfg.IPFS.GatewayURL) stateService, err := eth.NewStateService(eth.StateServiceConfig{ diff --git a/internal/api_ui/responses.go b/internal/api_ui/responses.go index 9fa96f2bc..955dc2457 100644 --- a/internal/api_ui/responses.go +++ b/internal/api_ui/responses.go @@ -153,7 +153,7 @@ func getProofs(credential *domain.Claim) []string { return proofs } -func connectionsResponse(conns []*domain.Connection) (GetConnectionsResponse, error) { +func connectionsResponse(conns []domain.Connection) (GetConnectionsResponse, error) { resp := make([]GetConnectionResponse, 0) var err error for _, conn := range conns { @@ -166,13 +166,13 @@ func connectionsResponse(conns []*domain.Connection) (GetConnectionsResponse, er return nil, err } } - resp = append(resp, connectionResponse(conn, w3creds, connCreds)) + resp = append(resp, connectionResponse(&conn, w3creds, connCreds)) } return resp, nil } -func connectionsPaginatedResponse(conns []*domain.Connection, pagFilter pagination.Filter, total uint) (ConnectionsPaginated, error) { +func connectionsPaginatedResponse(conns []domain.Connection, pagFilter pagination.Filter, total uint) (ConnectionsPaginated, error) { resp, err := connectionsResponse(conns) if err != nil { return ConnectionsPaginated{}, err diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 8c4c79fc2..be5b719f4 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -116,8 +116,9 @@ func TestServer_AuthCallback(t *testing.T) { func TestServer_GetAuthenticationConnection(t *testing.T) { connectionRepository := repositories.NewConnections() + claimsRepository := repositories.NewClaims() qrService := services.NewQrStoreService(cachex) - connectionsService := services.NewConnection(connectionRepository, storage) + connectionsService := services.NewConnection(connectionRepository, claimsRepository, storage) server := NewServer(&cfg, NewIdentityMock(), NewClaimsMock(), NewSchemaMock(), connectionsService, NewLinkMock(), qrService, NewPublisherMock(), NewPackageManagerMock(), nil) issuerDID, err := w3c.ParseDID("did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ") require.NoError(t, err) @@ -806,7 +807,7 @@ func TestServer_DeleteConnection(t *testing.T) { identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -949,8 +950,9 @@ func TestServer_DeleteConnection(t *testing.T) { func TestServer_DeleteConnectionCredentials(t *testing.T) { connectionsRepository := repositories.NewConnections() + claimsRepository := repositories.NewClaims() - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepository, storage) server := NewServer(&cfg, NewIdentityMock(), NewClaimsMock(), NewSchemaMock(), connectionsService, NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) handler := getHandler(context.Background(), server) @@ -1055,7 +1057,7 @@ func TestServer_RevokeConnectionCredentials(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, "http://localhost", pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -1167,7 +1169,7 @@ func TestServer_CreateCredential(t *testing.T) { identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) pubSub := pubsub.NewMock() claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubSub, ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -1446,7 +1448,7 @@ func TestServer_GetCredential(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -1640,7 +1642,7 @@ func TestServer_GetCredentials(t *testing.T) { claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) schemaService := services.NewSchema(schemaRepository, schemaLoader) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -2107,7 +2109,7 @@ func TestServer_GetCredentialQrCode(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, qrService, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -2261,7 +2263,7 @@ func TestServer_GetConnection(t *testing.T) { revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -2446,7 +2448,7 @@ func TestServer_GetConnections(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -2730,18 +2732,18 @@ func TestServer_GetConnections(t *testing.T) { response: GetConnections200JSONResponse{ Items: GetConnectionsResponse{ { - Id: connID.String(), + Id: connID2.String(), IssuerID: did.String(), - UserID: usrDID.String(), + UserID: usrDID2.String(), CreatedAt: TimeUTC(time.Now()), - Credentials: []Credential{{}, {}}, + Credentials: []Credential{}, }, { - Id: connID2.String(), + Id: connID.String(), IssuerID: did.String(), - UserID: usrDID2.String(), + UserID: usrDID.String(), CreatedAt: TimeUTC(time.Now()), - Credentials: []Credential{}, + Credentials: []Credential{{}, {}}, }, }, }, @@ -2820,7 +2822,7 @@ func TestServer_GetConnections(t *testing.T) { }, }, { - name: "should return one connection with not existing did and valid attributes", + name: "should return no connection with not existing did and valid attributes", auth: authOk, request: GetConnectionsRequestObject{ Params: GetConnectionsParams{ @@ -2831,15 +2833,7 @@ func TestServer_GetConnections(t *testing.T) { expected: expected{ httpCode: http.StatusOK, response: GetConnections200JSONResponse{ - Items: GetConnectionsResponse{ - { - Id: connID.String(), - IssuerID: did.String(), - UserID: usrDID.String(), - CreatedAt: TimeUTC(time.Now()), - Credentials: []Credential{{}, {}}, - }, - }, + Items: GetConnectionsResponse{}, }, }, }, @@ -3076,7 +3070,7 @@ func TestServer_GetConnections(t *testing.T) { for i := range response.Items { if tc.expected.response.Items[i].Credentials != nil { require.NotNil(t, response.Items[i].Credentials) - require.Equal(t, len(tc.expected.response.Items[i].Credentials), len(response.Items[i].Credentials)) + require.Equal(t, len(tc.expected.response.Items[i].Credentials), len(response.Items[i].Credentials), "connection.credentials") } assert.Equal(t, tc.expected.response.Items[i].Id, response.Items[i].Id) assert.Equal(t, tc.expected.response.Items[i].IssuerID, response.Items[i].IssuerID) @@ -3134,7 +3128,7 @@ func TestServer_RevokeCredential(t *testing.T) { claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) fixture := tests.NewFixture(storage) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -3273,7 +3267,7 @@ func TestServer_CreateLink(t *testing.T) { identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) pubSub := pubsub.NewMock() claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubSub, ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRespository, schemaLoader, sessionRepository, pubSub, ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -3498,7 +3492,7 @@ func TestServer_ActivateLink(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -3647,7 +3641,7 @@ func TestServer_GetLink(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -3823,7 +3817,7 @@ func TestServer_GetAllLinks(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -4057,7 +4051,7 @@ func TestServer_DeleteLink(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -4172,7 +4166,7 @@ func TestServer_DeleteLinkForDifferentDID(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -4285,7 +4279,7 @@ func TestServer_CreateLinkQRCode(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, qrService, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -4438,7 +4432,7 @@ func TestServer_GetLinkQRCode(t *testing.T) { qrService := services.NewQrStoreService(cachex) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, qrService, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) linkService := services.NewLinkService(storage, claimsService, qrService, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -4619,7 +4613,7 @@ func TestServer_GetStateStatus(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" credentialSubject := map[string]any{ "id": "did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ", @@ -4768,7 +4762,7 @@ func TestServer_GetStateTransactions(t *testing.T) { rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, nil, commonEth.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) @@ -4855,7 +4849,7 @@ func TestServer_GetRevocationStatus(t *testing.T) { identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) pubSub := pubsub.NewMock() claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubSub, ipfsGatewayURL, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) diff --git a/internal/core/ports/claims_repository.go b/internal/core/ports/claims_repository.go index 7e4ca1f99..df6e7ba00 100644 --- a/internal/core/ports/claims_repository.go +++ b/internal/core/ports/claims_repository.go @@ -29,5 +29,6 @@ type ClaimsRepository interface { UpdateClaimMTP(ctx context.Context, conn db.Querier, claim *domain.Claim) (int64, error) Delete(ctx context.Context, conn db.Querier, id uuid.UUID) error GetClaimsIssuedForUser(ctx context.Context, conn db.Querier, identifier w3c.DID, userDID w3c.DID, linkID uuid.UUID) ([]*domain.Claim, error) + GetClaimsOfAConnection(ctx context.Context, conn db.Querier, identifier w3c.DID, userDID w3c.DID) ([]*domain.Claim, error) GetByStateIDWithMTPProof(ctx context.Context, conn db.Querier, did *w3c.DID, state string) (claims []*domain.Claim, err error) } diff --git a/internal/core/ports/connections_repository.go b/internal/core/ports/connections_repository.go index 0a6896110..43fee7cd7 100644 --- a/internal/core/ports/connections_repository.go +++ b/internal/core/ports/connections_repository.go @@ -18,8 +18,7 @@ type ConnectionsRepository interface { DeleteCredentials(ctx context.Context, conn db.Querier, id uuid.UUID, issuerID w3c.DID) error GetByIDAndIssuerID(ctx context.Context, conn db.Querier, id uuid.UUID, issuerDID w3c.DID) (*domain.Connection, error) GetByUserID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, userDID w3c.DID) (*domain.Connection, error) - GetAllByIssuerID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, filter *NewGetAllConnectionsRequest) ([]*domain.Connection, uint, error) - GetAllWithCredentialsByIssuerID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, filter *NewGetAllConnectionsRequest) ([]*domain.Connection, uint, error) + GetAllWithCredentialsByIssuerID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, filter *NewGetAllConnectionsRequest) ([]domain.Connection, uint, error) GetByUserSessionID(ctx context.Context, conn db.Querier, sessionID uuid.UUID) (*domain.Connection, error) SaveUserAuthentication(ctx context.Context, conn db.Querier, connID uuid.UUID, sessID uuid.UUID, mTime time.Time) error } diff --git a/internal/core/ports/connections_service.go b/internal/core/ports/connections_service.go index 4f5644134..99ae674e0 100644 --- a/internal/core/ports/connections_service.go +++ b/internal/core/ports/connections_service.go @@ -59,6 +59,6 @@ type ConnectionsService interface { DeleteCredentials(ctx context.Context, id uuid.UUID, issuerID w3c.DID) error GetByIDAndIssuerID(ctx context.Context, id uuid.UUID, issuerDID w3c.DID) (*domain.Connection, error) GetByUserID(ctx context.Context, issuerDID w3c.DID, userID w3c.DID) (*domain.Connection, error) - GetAllByIssuerID(ctx context.Context, issuerDID w3c.DID, request *NewGetAllConnectionsRequest) ([]*domain.Connection, uint, error) + GetAllByIssuerID(ctx context.Context, issuerDID w3c.DID, request *NewGetAllConnectionsRequest) ([]domain.Connection, uint, error) GetByUserSessionID(ctx context.Context, sessionID uuid.UUID) (*domain.Connection, error) } diff --git a/internal/core/services/connections.go b/internal/core/services/connections.go index 0b5b455cf..bd7fbd0de 100644 --- a/internal/core/services/connections.go +++ b/internal/core/services/connections.go @@ -8,6 +8,7 @@ import ( "github.com/iden3/go-iden3-core/v2/w3c" "github.com/jackc/pgx/v4" + "github.com/polygonid/sh-id-platform/internal/common" "github.com/polygonid/sh-id-platform/internal/core/domain" "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/db" @@ -18,15 +19,17 @@ import ( var ErrConnectionDoesNotExist = errors.New("connection does not exist") type connection struct { - connRepo ports.ConnectionsRepository - storage *db.Storage + connRepo ports.ConnectionsRepository + claimsRepo ports.ClaimsRepository + storage *db.Storage } // NewConnection returns a new connection service -func NewConnection(connRepo ports.ConnectionsRepository, storage *db.Storage) ports.ConnectionsService { +func NewConnection(connRepo ports.ConnectionsRepository, claimsRepo ports.ClaimsRepository, storage *db.Storage) ports.ConnectionsService { return &connection{ - connRepo: connRepo, - storage: storage, + connRepo: connRepo, + claimsRepo: claimsRepo, + storage: storage, } } @@ -83,12 +86,20 @@ func (c *connection) GetByUserID(ctx context.Context, issuerDID w3c.DID, userID return conn, nil } -func (c *connection) GetAllByIssuerID(ctx context.Context, issuerDID w3c.DID, filter *ports.NewGetAllConnectionsRequest) ([]*domain.Connection, uint, error) { +func (c *connection) GetAllByIssuerID(ctx context.Context, issuerDID w3c.DID, filter *ports.NewGetAllConnectionsRequest) ([]domain.Connection, uint, error) { + conns, count, err := c.connRepo.GetAllWithCredentialsByIssuerID(ctx, c.storage.Pgx, issuerDID, filter) if filter.WithCredentials { - return c.connRepo.GetAllWithCredentialsByIssuerID(ctx, c.storage.Pgx, issuerDID, filter) - } + for i := range conns { + claims, err := c.claimsRepo.GetClaimsOfAConnection(ctx, c.storage.Pgx, issuerDID, conns[i].UserDID) + if err != nil { + return nil, 0, err + } + conns[i].Credentials = common.ToPointer(domain.Credentials(claims)) + } - return c.connRepo.GetAllByIssuerID(ctx, c.storage.Pgx, issuerDID, filter) + return conns, count, err + } + return conns, count, err } func (c *connection) delete(ctx context.Context, id uuid.UUID, issuerDID w3c.DID, pgx db.Querier) error { diff --git a/internal/core/services/tests/notification_test.go b/internal/core/services/tests/notification_test.go index b65523d47..ae717950f 100644 --- a/internal/core/services/tests/notification_test.go +++ b/internal/core/services/tests/notification_test.go @@ -42,7 +42,7 @@ func TestNotification_SendNotification(t *testing.T) { revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus) identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver) credentialsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, docLoader, storage, cfg.CredentialStatus.DirectStatus.GetURL(), pubsub.NewMock(), ipfsGateway, revocationStatusResolver) - connectionsService := services.NewConnection(connectionsRepository, storage) + connectionsService := services.NewConnection(connectionsRepository, claimsRepo, storage) iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index 26b730b0a..a1161f263 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -17,7 +17,6 @@ import ( "github.com/labstack/gommon/log" "github.com/lib/pq" - "github.com/polygonid/sh-id-platform/internal/common" "github.com/polygonid/sh-id-platform/internal/core/domain" "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/db" @@ -918,6 +917,66 @@ func (c *claims) GetAuthClaimsForPublishing(ctx context.Context, conn db.Querier return claims, nil } +func (c *claims) GetClaimsOfAConnection(ctx context.Context, conn db.Querier, identifier w3c.DID, userDID w3c.DID) ([]*domain.Claim, error) { + query := `SELECT claims.id, + issuer, + schema_hash, + schema_type, + schema_url, + other_identifier, + expiration, + updatable, + claims.version, + rev_nonce, + mtp_proof, + signature_proof, + data, + claims.identifier, + identity_state, + credential_status, + revoked, + core_claim + FROM claims + WHERE claims.identifier = $1 + AND claims.other_identifier = $2 + ` + rows, err := conn.Query(ctx, query, identifier.String(), userDID.String()) + if err != nil { + return nil, err + } + defer rows.Close() + + claims := make([]*domain.Claim, 0) + + for rows.Next() { + var claim domain.Claim + err := rows.Scan(&claim.ID, + &claim.Issuer, + &claim.SchemaHash, + &claim.SchemaType, + &claim.SchemaHash, + &claim.OtherIdentifier, + &claim.Expiration, + &claim.Updatable, + &claim.Version, + &claim.RevNonce, + &claim.MTPProof, + &claim.SignatureProof, + &claim.Data, + &claim.Identifier, + &claim.IdentityState, + &claim.CredentialStatus, + &claim.Revoked, + &claim.CoreClaim) + if err != nil { + return nil, err + } + claims = append(claims, &claim) + } + + return claims, nil +} + func (c *claims) GetClaimsIssuedForUser(ctx context.Context, conn db.Querier, identifier w3c.DID, userDID w3c.DID, linkID uuid.UUID) ([]*domain.Claim, error) { query := `SELECT claims.id, issuer, @@ -946,6 +1005,7 @@ func (c *claims) GetClaimsIssuedForUser(ctx context.Context, conn db.Querier, id if err != nil { return nil, err } + defer rows.Close() claims := make([]*domain.Claim, 0) @@ -974,8 +1034,6 @@ func (c *claims) GetClaimsIssuedForUser(ctx context.Context, conn db.Querier, id } claims = append(claims, &claim) } - - defer rows.Close() return claims, nil } @@ -1039,70 +1097,3 @@ func (c *claims) GetByStateIDWithMTPProof(ctx context.Context, conn db.Querier, return claims, nil } - -func toCredentialDomain(c *dbClaim) *domain.Claim { - if c.ID == nil { - return nil - } - - credential := &domain.Claim{ - ID: *c.ID, - } - - if c.CoreClaim != nil { - credential.CoreClaim = *c.CoreClaim - } - if c.Data != nil { - credential.Data = *c.Data - } - if c.SignatureProof != nil { - credential.SignatureProof = *c.SignatureProof - } - if c.CredentialStatus != nil { - credential.CredentialStatus = *c.CredentialStatus - } - if c.Identifier.Valid { - credential.Identifier = common.ToPointer(c.Identifier.String) - } - if c.Issuer.Valid { - credential.Issuer = c.Issuer.String - } - if c.SchemaHash.Valid { - credential.SchemaHash = c.SchemaHash.String - } - if c.SchemaURL.Valid { - credential.SchemaURL = c.SchemaURL.String - } - if c.SchemaType.Valid { - credential.SchemaType = c.SchemaType.String - } - if c.OtherIdentifier.Valid { - credential.OtherIdentifier = c.OtherIdentifier.String - } - if c.Expiration != nil { - credential.Expiration = *c.Expiration - } - if c.Updatable.Valid { - credential.Updatable = c.Updatable.Bool - } - if c.RevNonce != nil { - credential.RevNonce = domain.RevNonceUint64(*c.RevNonce) - } - if c.Revoked.Valid { - credential.Revoked = c.Revoked.Bool - } - if c.IdentityState.Valid { - credential.IdentityState = common.ToPointer(c.IdentityState.String) - } - if c.Status.Valid { - credential.Status = common.ToPointer(domain.IdentityStatus(c.Status.String)) - } - if c.HIndex.Valid { - credential.HIndex = c.HIndex.String - } - if c.MtProof.Valid { - credential.MtProof = c.MtProof.Bool - } - - return credential -} diff --git a/internal/repositories/connections.go b/internal/repositories/connections.go index 670e11363..f6df50078 100644 --- a/internal/repositories/connections.go +++ b/internal/repositories/connections.go @@ -156,53 +156,7 @@ func (c *connections) GetByUserID(ctx context.Context, conn db.Querier, issuerDI return toConnectionDomain(&connection) } -func (c *connections) GetAllByIssuerID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, filter *ports.NewGetAllConnectionsRequest) ([]*domain.Connection, uint, error) { - var count uint - fields := []string{"id", "issuer_id", "user_id", "issuer_doc", "user_doc", "created_at", "modified_at"} - all := `SELECT ##QUERYFIELDS## - FROM connections - WHERE connections.issuer_id = $1` - - if filter.Query != "" { - dids := tokenizeQuery(filter.Query) - if len(dids) > 0 { - all += " AND (" + buildPartialQueryDidLikes("connections.user_id", dids, "OR") + ")" - } - } - - _ = filter.OrderBy.Add(ports.ConnectionsCreatedAt, true) - countQuery := strings.Replace(all, "##QUERYFIELDS##", "COUNT(*)", 1) - all += " ORDER BY " + filter.OrderBy.String() - - if err := conn.QueryRow(ctx, countQuery, issuerDID.String()).Scan(&count); err != nil { - return nil, 0, err - } - all += fmt.Sprintf(" OFFSET %d LIMIT %d;", filter.Pagination.GetOffset(), filter.Pagination.GetLimit()) - - all = strings.Replace(all, "##QUERYFIELDS##", strings.Join(fields, ","), 1) - rows, err := conn.Query(ctx, all, issuerDID.String()) - if err != nil { - return nil, 0, err - } - defer rows.Close() - - domainConns := make([]*domain.Connection, 0) - dbConn := dbConnection{} - for rows.Next() { - if err := rows.Scan(&dbConn.ID, &dbConn.IssuerDID, &dbConn.UserDID, &dbConn.IssuerDoc, &dbConn.UserDoc, &dbConn.CreatedAt, &dbConn.ModifiedAt); err != nil { - return nil, 0, err - } - domainConn, err := toConnectionDomain(&dbConn) - if err != nil { - return nil, 0, err - } - domainConns = append(domainConns, domainConn) - } - - return domainConns, count, nil -} - -func (c *connections) GetAllWithCredentialsByIssuerID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, filter *ports.NewGetAllConnectionsRequest) ([]*domain.Connection, uint, error) { +func (c *connections) GetAllWithCredentialsByIssuerID(ctx context.Context, conn db.Querier, issuerDID w3c.DID, filter *ports.NewGetAllConnectionsRequest) ([]domain.Connection, uint, error) { var count uint sqlQuery, countQuery, filters := buildGetAllWithCredentialsQueryAndFilters(issuerDID, filter) @@ -218,6 +172,9 @@ func (c *connections) GetAllWithCredentialsByIssuerID(ctx context.Context, conn defer rows.Close() conns, err := toConnectionsWithCredentials(rows) + if err != nil { + return nil, 0, err + } return conns, count, err } @@ -231,56 +188,24 @@ func buildGetAllWithCredentialsQueryAndFilters(issuerDID w3c.DID, filter *ports. "connections.user_doc", "connections.created_at", "connections.modified_at", - "claims.id", - "claims.issuer", - "claims.schema_hash", - "claims.schema_url", - "claims.schema_type", - "claims.other_identifier", - "claims.expiration", - "claims.version", - "claims.rev_nonce", - "claims.updatable", - "claims.signature_proof", - "claims.mtp_proof", - "claims.data", - "claims.identifier", - "claims.identity_state", - "identity_states.status", - "claims.credential_status", - "claims.core_claim", - "claims.mtp", - "claims.created_at", } - sqlQuery := `SELECT ##QUERYFIELDS## - FROM connections - LEFT JOIN claims - ON connections.issuer_id = claims.issuer AND connections.user_id = claims.other_identifier - LEFT JOIN identity_states ON claims.identity_state = identity_states.state` - - if filter.Query != "" { - sqlQuery = fmt.Sprintf("%s LEFT JOIN schemas ON claims.schema_hash=schemas.hash AND claims.issuer=schemas.issuer_id ", sqlQuery) - } + sqlQuery := `SELECT ##QUERYFIELDS## FROM connections` sqlArgs := []interface{}{issuerDID.String()} - sqlQuery = fmt.Sprintf("%s WHERE connections.issuer_id = $%d", sqlQuery, len(sqlArgs)) + if filter.Query != "" { terms := tokenizeQuery(filter.Query) if len(terms) > 0 { - ftsConds := buildPartialQueryLikes("schemas.words", "OR", len(sqlArgs)+1, len(terms)) + " OR " + buildPartialQueryDidLikes("connections.user_id", terms, "OR") + ftsConds := buildPartialQueryDidLikes("connections.user_id", terms, "OR") sqlQuery += fmt.Sprintf(" AND (%s) ", ftsConds) - for _, term := range terms { - sqlArgs = append(sqlArgs, term) - } } } countQuery := strings.Replace(sqlQuery, "##QUERYFIELDS##", "COUNT(*)", 1) sqlQuery = strings.Replace(sqlQuery, "##QUERYFIELDS##", strings.Join(fields, ","), 1) - _ = filter.OrderBy.AddWithNullsLast("claims.created_at", true) _ = filter.OrderBy.Add(ports.ConnectionsCreatedAt, true) sqlQuery += " ORDER BY " + filter.OrderBy.String() @@ -289,10 +214,8 @@ func buildGetAllWithCredentialsQueryAndFilters(issuerDID w3c.DID, filter *ports. return sqlQuery, countQuery, sqlArgs } -func toConnectionsWithCredentials(rows pgx.Rows) ([]*domain.Connection, error) { - orderedConns := make([]uuid.UUID, 0) - dbConns := make(map[uuid.UUID]*domain.Connection, 0) - +func toConnectionsWithCredentials(rows pgx.Rows) ([]domain.Connection, error) { + resp := make([]domain.Connection, 0) for rows.Next() { var dbConn dbConnectionWithCredentials err := rows.Scan( @@ -302,69 +225,19 @@ func toConnectionsWithCredentials(rows pgx.Rows) ([]*domain.Connection, error) { &dbConn.IssuerDoc, &dbConn.UserDoc, &dbConn.dbConnection.CreatedAt, - &dbConn.ModifiedAt, - &dbConn.dbClaim.ID, - &dbConn.Issuer, - &dbConn.SchemaHash, - &dbConn.SchemaURL, - &dbConn.SchemaType, - &dbConn.OtherIdentifier, - &dbConn.Expiration, - &dbConn.Version, - &dbConn.RevNonce, - &dbConn.Updatable, - &dbConn.SignatureProof, - &dbConn.MTPProof, - &dbConn.Data, - &dbConn.Identifier, - &dbConn.IdentityState, - &dbConn.Status, - &dbConn.CredentialStatus, - &dbConn.CoreClaim, - &dbConn.MtProof, - &dbConn.dbClaim.CreatedAt) + &dbConn.ModifiedAt) if err != nil { return nil, err } - - if conn, ok := dbConns[dbConn.dbConnection.ID]; !ok { - orderedConns = append(orderedConns, dbConn.dbConnection.ID) - domainConn, err := toConnectionWithCredentialsDomain(dbConn) - if err != nil { - return nil, err - } - dbConns[dbConn.dbConnection.ID] = domainConn - } else { - *conn.Credentials = append(*conn.Credentials, toCredentialDomain(&dbConn.dbClaim)) - dbConns[dbConn.dbConnection.ID] = conn + c, err := toConnectionDomain(&dbConn.dbConnection) + if err != nil { + return nil, err } + resp = append(resp, *c) } - - resp := make([]*domain.Connection, len(orderedConns)) - for i, conn := range orderedConns { - resp[i] = dbConns[conn] - } - return resp, nil } -func toConnectionWithCredentialsDomain(dbConn dbConnectionWithCredentials) (*domain.Connection, error) { - domainConn, err := toConnectionDomain(&dbConn.dbConnection) - if err != nil { - return nil, err - } - - creds := make(domain.Credentials, 0) - cred := toCredentialDomain(&dbConn.dbClaim) - if cred != nil { - creds = append(creds, cred) - } - - domainConn.Credentials = &creds - - return domainConn, err -} - func toConnectionDomain(c *dbConnection) (*domain.Connection, error) { issID, err := w3c.ParseDID(c.IssuerDID) if err != nil { diff --git a/internal/repositories/tests/connections_test.go b/internal/repositories/tests/connections_test.go index 25745d34b..4f82e78f8 100644 --- a/internal/repositories/tests/connections_test.go +++ b/internal/repositories/tests/connections_test.go @@ -162,49 +162,49 @@ func TestConnectionsGetAllByIssuerID(t *testing.T) { }) t.Run("should get 0 connections for a non existing issuerDID", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *userDID, &ports.NewGetAllConnectionsRequest{Query: ""}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *userDID, &ports.NewGetAllConnectionsRequest{Query: ""}) require.NoError(t, err) assert.Equal(t, 0, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and no query", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: ""}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: ""}) require.NoError(t, err) assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and valid query, just beginning", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:"}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:"}) require.NoError(t, err) assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and valid query, full did", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAwYQzCp9VfhpNgeLtK2iCehDDrfMWUCEg5ig5"}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAwYQzCp9VfhpNgeLtK2iCehDDrfMWUCEg5ig5"}) require.NoError(t, err) assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and valid query, part of did", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAw"}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAw"}) require.NoError(t, err) assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and a query with some chars in the middle of a string", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "H7XAw"}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "H7XAw"}) require.NoError(t, err) assert.Equal(t, 1, len(conns)) }) t.Run("should get 1 connection for a the given issuerDID and a query with some chars in the middle of a string and other words", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "H7XAw other words"}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "H7XAw other words"}) require.NoError(t, err) assert.Equal(t, 1, len(conns)) }) t.Run("should get 0 connections for a the given issuerDID and non existing userDID", func(t *testing.T) { - conns, _, err := connectionsRepo.GetAllByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAwnonexisting"}) + conns, _, err := connectionsRepo.GetAllWithCredentialsByIssuerID(ctx, storage.Pgx, *issuerDID, &ports.NewGetAllConnectionsRequest{Query: "did:polygonid:polygon:mumbai:2qH7XAwnonexisting"}) require.NoError(t, err) assert.Equal(t, 0, len(conns)) }) From 1969d5800a493edc1566db35a324b141894e060a Mon Sep 17 00:00:00 2001 From: x1m3 Date: Wed, 28 Feb 2024 15:35:37 +0100 Subject: [PATCH 086/110] chore: Check errors when registering custom did methods. --- cmd/issuer_initializer/main.go | 7 +++++-- cmd/platform/main.go | 8 +++++--- cmd/platform_ui/main.go | 5 ++++- internal/core/services/did_registrator.go | 14 +++++++++++--- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/cmd/issuer_initializer/main.go b/cmd/issuer_initializer/main.go index ae72ecdd8..e42e672b5 100644 --- a/cmd/issuer_initializer/main.go +++ b/cmd/issuer_initializer/main.go @@ -47,13 +47,16 @@ func main() { log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) - services.RegisterCustomDIDMethods(cfg.CustomDIDMethods) - if err := cfg.Sanitize(ctx); err != nil { log.Error(ctx, "there are errors in the configuration that prevent server to start", "err", err) return } + if err := services.RegisterCustomDIDMethods(ctx, cfg.CustomDIDMethods); err != nil { + log.Error(ctx, "cannot register custom DID methods. Server cannot start", "err", err) + return + } + storage, err := db.NewStorage(cfg.Database.URL) if err != nil { log.Error(ctx, "cannot connect to database", "err", err) diff --git a/cmd/platform/main.go b/cmd/platform/main.go index a4c71faec..f221e75f0 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -52,9 +52,6 @@ func main() { log.Error(ctx, "cannot load config", "err", err) return } - - services.RegisterCustomDIDMethods(cfg.CustomDIDMethods) - log.Config(cfg.Log.Level, cfg.Log.Mode, os.Stdout) if err := cfg.Sanitize(ctx); err != nil { @@ -62,6 +59,11 @@ func main() { return } + if err := services.RegisterCustomDIDMethods(ctx, cfg.CustomDIDMethods); err != nil { + log.Error(ctx, "cannot register custom DID methods. Server cannot start", "err", err) + return + } + storage, err := db.NewStorage(cfg.Database.URL) if err != nil { log.Error(ctx, "cannot connect to database", "err", err) diff --git a/cmd/platform_ui/main.go b/cmd/platform_ui/main.go index d4e4574a2..27d9f5e3c 100644 --- a/cmd/platform_ui/main.go +++ b/cmd/platform_ui/main.go @@ -67,7 +67,10 @@ func main() { return } - services.RegisterCustomDIDMethods(cfg.CustomDIDMethods) + if err := services.RegisterCustomDIDMethods(ctx, cfg.CustomDIDMethods); err != nil { + log.Error(ctx, "cannot register custom DID methods. Server cannot start", "err", err) + return + } storage, err := db.NewStorage(cfg.Database.URL) if err != nil { diff --git a/internal/core/services/did_registrator.go b/internal/core/services/did_registrator.go index 9462795d2..eb03f2016 100644 --- a/internal/core/services/did_registrator.go +++ b/internal/core/services/did_registrator.go @@ -1,19 +1,27 @@ package services import ( + "context" + core "github.com/iden3/go-iden3-core/v2" + "github.com/polygonid/sh-id-platform/internal/config" + "github.com/polygonid/sh-id-platform/internal/log" ) // RegisterCustomDIDMethods registers custom DID methods -func RegisterCustomDIDMethods(customdDids []config.CustomDIDMethods) { - for _, cdid := range customdDids { +func RegisterCustomDIDMethods(ctx context.Context, customsDis []config.CustomDIDMethods) error { + for _, cdid := range customsDis { params := core.DIDMethodNetworkParams{ Method: core.DIDMethodPolygonID, Blockchain: core.Blockchain(cdid.Blockchain), Network: core.NetworkID(cdid.Network), NetworkFlag: cdid.NetworkFlag, } - core.RegisterDIDMethodNetwork(params, core.WithChainID(cdid.ChainID)) + if err := core.RegisterDIDMethodNetwork(params, core.WithChainID(cdid.ChainID)); err != nil { + log.Error(ctx, "cannot register custom DID method", "err", err, "customDID", cdid) + return err + } } + return nil } From 828264ebf2d8b478c551fbc9b6302d2adfed165e Mon Sep 17 00:00:00 2001 From: Javi Date: Wed, 6 Mar 2024 09:35:06 +0100 Subject: [PATCH 087/110] docs: adding CONTRIBUTING.md (#627) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: adding CONTRIBUTING.md * Update CONTRIBUTING.md Co-authored-by: Jordi Giménez * Update CONTRIBUTING.md Co-authored-by: Jordi Giménez * Update CONTRIBUTING.md Co-authored-by: Jordi Giménez --------- Co-authored-by: Jordi Giménez --- CONTRIBUTING.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..ced61c1e5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,72 @@ +# Contributing to Issuer Node + +Welcome to Issuer Node! We're thrilled to have you here. Before you get started, please take a moment to review the following guidelines. + +### Contents + +- [How to Contribute](#how-to-contribute) +- [Getting Started](#getting-started) +- [Issue Tracker Guidelines](#issue-tracker-guidelines) +- [Code Contribution Guidelines](#code-contribution-guidelines) +- [Testing Guidelines](#testing-guidelines) +- [Documentation](#documentation) +- [License Information](#license-information) +- [Contact Information](#contact-information) + +## How to Contribute + +**Reporting Issues**: If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. If the bug is a security vulnerability, please report it directly [here](https://support.polygon.technology/support/solutions/categories/82000473421/folders/82000694808). + +**Requesting Features**: If you have ideas for new features or enhancements, please submit a feature request on GitHub. + +**Submitting Changes**: Fork the repository, make your changes, and submit a pull request. Be sure to follow the guidelines outlined below. + +## Getting Started + +To set up the project locally, follow the [README](./README.md#quick-start-installation) instructions. + +For an advanced setup, visit our [extended documentation](https://devs.polygonid.com/docs/issuer/issuer-configuration). + +## Issue Tracker Guidelines + +Search for existing issues before creating new ones. + +Provide detailed information and steps to reproduce when reporting bugs. + +Follow the issue template if available. + +## Code Contribution Guidelines +Before submitting a contribution, please consider whether it will be useful to the community and try to minimise breaking changes. In general, a Pull Request with breaking changes is unlikely to be accepted immediately. +Submit concise and focused pull requests with clear descriptions. + +Follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification both for the commits and PR names. + +Use develop as the base and target branch for pull requests. + +Be responsive to feedback and address any review comments promptly. + +## Testing Guidelines + +Write tests for new features or changes + +Ensure all existing tests pass and the linter reports no errors before submitting your changes. + +Run tests and linter locally with: +``` bash +make up-test // To start the database used by tests +make tests // run all tests +make lint // run linter +``` + +## Documentation + +Keep documentation up-to-date with any changes or additions. +Help improve existing documentation or contribute new documentation as needed. + +## License Information + +By contributing to this project, you agree to the terms of licenses [Apache](LICENSE-APACHE) and [Mit](LICENSE-MIT). + +## Contact Information + +If you have any questions or need assistance, feel free to contact the project maintainers [here](https://support.polygon.technology/support/solutions/categories/82000473421/folders/82000694808). \ No newline at end of file From a239db6c797af3153dd927aaea1b480a016d4762 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 22 Mar 2024 11:03:27 -0300 Subject: [PATCH 088/110] chore: add test deploy backend --- .github/workflows/test_deploy_backend.yml | 66 +++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/test_deploy_backend.yml diff --git a/.github/workflows/test_deploy_backend.yml b/.github/workflows/test_deploy_backend.yml new file mode 100644 index 000000000..07a99835b --- /dev/null +++ b/.github/workflows/test_deploy_backend.yml @@ -0,0 +1,66 @@ +name: Deploy Issuer Node Backend to Testing AWS Environment + +on: + workflow_run: + workflows: ["Checks"] + branches: ["develop"] + types: + - completed + +env: + AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} + ECR_REPOSITORY: issuer_node_backend_testing + +jobs: + build-backend: + name: Build and push latest image to AWS Testing Environment + permissions: + id-token: write + contents: write + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "1.20" + - uses: actions/cache@v3 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - run: make build/docker + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1-node16 + with: + aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole + role-session-name: GitHubActionsSession + + - name: Login to Amazon ECR + uses: aws-actions/amazon-ecr-login@v1 + id: login-ecr + + - name: Get version + run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" + id: version + + - name: Tag and push image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + IMAGE_TAG: ${{ steps.version.outputs.VERSION }} + run: | + docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + + docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \ No newline at end of file From c537604d319ea53e8e75fac11465bb1dbbaff12a Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 22 Mar 2024 11:26:17 -0300 Subject: [PATCH 089/110] chore: add test deploy backend --- .github/workflows/test_deploy_backend.yml | 66 +++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/test_deploy_backend.yml diff --git a/.github/workflows/test_deploy_backend.yml b/.github/workflows/test_deploy_backend.yml new file mode 100644 index 000000000..07a99835b --- /dev/null +++ b/.github/workflows/test_deploy_backend.yml @@ -0,0 +1,66 @@ +name: Deploy Issuer Node Backend to Testing AWS Environment + +on: + workflow_run: + workflows: ["Checks"] + branches: ["develop"] + types: + - completed + +env: + AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} + ECR_REPOSITORY: issuer_node_backend_testing + +jobs: + build-backend: + name: Build and push latest image to AWS Testing Environment + permissions: + id-token: write + contents: write + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "1.20" + - uses: actions/cache@v3 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - run: make build/docker + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1-node16 + with: + aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole + role-session-name: GitHubActionsSession + + - name: Login to Amazon ECR + uses: aws-actions/amazon-ecr-login@v1 + id: login-ecr + + - name: Get version + run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" + id: version + + - name: Tag and push image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + IMAGE_TAG: ${{ steps.version.outputs.VERSION }} + run: | + docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + + docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \ No newline at end of file From 8bed2f64a39535f76145da5c4edada0dc1df0b73 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 22 Mar 2024 11:36:15 -0300 Subject: [PATCH 090/110] chore: update readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 98d99b8f2..fc85a08fd 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ In this section we will cover the installation of the Issuer Node API. 1. Copy the config sample files: - ```bash + ```shell cp .env-issuer.sample .env-issuer cp .env-api.sample .env-api ``` @@ -69,12 +69,12 @@ In this section we will cover the installation of the Issuer Node API. 2. Fill the .env-issuer config file with the proper variables: *.env-issuer* - ```bash + ```shell ISSUER_ETHEREUM_URL= ``` 3. Start the infrastructure: - ```bash + ```shell make up ``` From f323b5c4ae088c600ead252d9e60a3a89f53a6ab Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 22 Mar 2024 12:02:50 -0300 Subject: [PATCH 091/110] chore: update github action --- .github/workflows/test_deploy_backend.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_deploy_backend.yml b/.github/workflows/test_deploy_backend.yml index 07a99835b..32e0a82e5 100644 --- a/.github/workflows/test_deploy_backend.yml +++ b/.github/workflows/test_deploy_backend.yml @@ -36,6 +36,10 @@ jobs: restore-keys: | ${{ runner.os }}-go- + - name: Create .env-api + run: | + touch .env-api + - run: make build/docker - name: Configure AWS credentials From c200325b2ca259bde4f976e555f54fd8a524833d Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 22 Mar 2024 12:12:53 -0300 Subject: [PATCH 092/110] chore: update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc85a08fd..19869c360 100644 --- a/README.md +++ b/README.md @@ -69,12 +69,12 @@ In this section we will cover the installation of the Issuer Node API. 2. Fill the .env-issuer config file with the proper variables: *.env-issuer* - ```shell + ```bash ISSUER_ETHEREUM_URL= ``` 3. Start the infrastructure: - ```shell + ```bash make up ``` From fedc832f1e8c95a6701be8fabc1ac1f05f2549e9 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Mon, 25 Mar 2024 08:18:02 -0300 Subject: [PATCH 093/110] chore: delete github action --- .github/workflows/test_deploy_backend.yml | 66 ----------------------- 1 file changed, 66 deletions(-) delete mode 100644 .github/workflows/test_deploy_backend.yml diff --git a/.github/workflows/test_deploy_backend.yml b/.github/workflows/test_deploy_backend.yml deleted file mode 100644 index 07a99835b..000000000 --- a/.github/workflows/test_deploy_backend.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Deploy Issuer Node Backend to Testing AWS Environment - -on: - workflow_run: - workflows: ["Checks"] - branches: ["develop"] - types: - - completed - -env: - AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - ECR_REPOSITORY: issuer_node_backend_testing - -jobs: - build-backend: - name: Build and push latest image to AWS Testing Environment - permissions: - id-token: write - contents: write - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.20" - - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - run: make build/docker - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1-node16 - with: - aws-region: ${{ env.AWS_DEFAULT_REGION }} - role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole - role-session-name: GitHubActionsSession - - - name: Login to Amazon ECR - uses: aws-actions/amazon-ecr-login@v1 - id: login-ecr - - - name: Get version - run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" - id: version - - - name: Tag and push image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} - IMAGE_TAG: ${{ steps.version.outputs.VERSION }} - run: | - docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - - docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \ No newline at end of file From c311b7c6071f3e6ded7e5dda5af0f20491cabb77 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Mon, 25 Mar 2024 08:23:18 -0300 Subject: [PATCH 094/110] chore: add deploy ui to testing env --- .github/workflows/test_deploy_ui.yml | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/test_deploy_ui.yml diff --git a/.github/workflows/test_deploy_ui.yml b/.github/workflows/test_deploy_ui.yml new file mode 100644 index 000000000..3296559a4 --- /dev/null +++ b/.github/workflows/test_deploy_ui.yml @@ -0,0 +1,61 @@ +name: Deploy Issuer Node UI to Testing AWS Environment + +on: + push: + branches: + - develop + +env: + AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} + ECR_REPOSITORY: issuer_node_ui_testing + +jobs: + deploy: + name: Build and Deploy UI to Testing AWS Environment + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: 16 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1-node16 + with: + aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole + role-session-name: GitHubActionsSession + + - name: Login to Amazon ECR + uses: aws-actions/amazon-ecr-login@v1 + id: login-ecr + + - name: Get version + run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" + id: version + + - name: build ui docker image + working-directory: ./ui + env: + IMAGE_TAG: ${{ steps.version.outputs.VERSION }} + run: | + docker build -t polygonid/issuernode_ui:${{ env.IMAGE_TAG }} . + + + - name: Tag and push image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + IMAGE_TAG: ${{ steps.version.outputs.VERSION }} + run: | + docker tag polygonid/issuernode_ui:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + + docker tag polygonid/issuernode_ui:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \ No newline at end of file From fb07a4a847f28b58b05a18dcacc55dc59e9649a1 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Mon, 25 Mar 2024 08:57:49 -0300 Subject: [PATCH 095/110] chore: add deploy ui to testing env --- .github/workflows/test_deploy_ui.yml | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/test_deploy_ui.yml diff --git a/.github/workflows/test_deploy_ui.yml b/.github/workflows/test_deploy_ui.yml new file mode 100644 index 000000000..3296559a4 --- /dev/null +++ b/.github/workflows/test_deploy_ui.yml @@ -0,0 +1,61 @@ +name: Deploy Issuer Node UI to Testing AWS Environment + +on: + push: + branches: + - develop + +env: + AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} + ECR_REPOSITORY: issuer_node_ui_testing + +jobs: + deploy: + name: Build and Deploy UI to Testing AWS Environment + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: 16 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1-node16 + with: + aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole + role-session-name: GitHubActionsSession + + - name: Login to Amazon ECR + uses: aws-actions/amazon-ecr-login@v1 + id: login-ecr + + - name: Get version + run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" + id: version + + - name: build ui docker image + working-directory: ./ui + env: + IMAGE_TAG: ${{ steps.version.outputs.VERSION }} + run: | + docker build -t polygonid/issuernode_ui:${{ env.IMAGE_TAG }} . + + + - name: Tag and push image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + IMAGE_TAG: ${{ steps.version.outputs.VERSION }} + run: | + docker tag polygonid/issuernode_ui:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + + docker tag polygonid/issuernode_ui:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest + docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \ No newline at end of file From 2578d8a7f7760a57dd0d33fefe5f62eee3cf8d4b Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 5 Apr 2024 07:21:33 -0300 Subject: [PATCH 096/110] fix: update identity state for mtp credentials --- internal/core/services/identity.go | 28 ++- internal/core/services/tests/identity_test.go | 159 ++++++++++++------ internal/repositories/claims.go | 3 +- 3 files changed, 127 insertions(+), 63 deletions(-) diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index d1ffa13d7..f3523e860 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -310,6 +310,7 @@ func (i *identity) GetKeyIDFromAuthClaim(ctx context.Context, authClaim *domain. } func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.IdentityState, error) { + const authBJJCredential = "https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential" newState := &domain.IdentityState{ Identifier: did.String(), Status: domain.StatusCreated, @@ -327,19 +328,27 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi return fmt.Errorf("error getting the identifier last state: %w", err) } - lc, err := i.claimsRepository.GetAllByState(ctx, tx, &did, nil) + var state *merkletree.Hash = nil + if previousState != nil { + state = previousState.TreeState().State + } + + lc, err := i.claimsRepository.GetAllByState(ctx, tx, &did, state) if err != nil { return fmt.Errorf("error getting the states: %w", err) } - if len(lc) == 0 { - return ErrNoClaimsFoundToProcess + // Check if there are claims to process + if err := checkClaimsToAdd(lc, authBJJCredential); err != nil { + return err } for i := range lc { - err = iTrees.AddClaim(ctx, &lc[i]) - if err != nil { - return err + if lc[i].IdentityState == nil { + err = iTrees.AddClaim(ctx, &lc[i]) + if err != nil { + return err + } } } @@ -395,6 +404,13 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi return newState, err } +func checkClaimsToAdd(lc []domain.Claim, authCoreClaim string) error { + if len(lc) == 0 || len(lc) == 1 && lc[0].SchemaType == authCoreClaim { + return ErrNoClaimsFoundToProcess + } + return nil +} + func (i *identity) UpdateIdentityState(ctx context.Context, state *domain.IdentityState) error { // save identity to store err := i.storage.Pgx.BeginFunc(ctx, func(tx pgx.Tx) error { diff --git a/internal/core/services/tests/identity_test.go b/internal/core/services/tests/identity_test.go index af20cc5bb..41db65e54 100644 --- a/internal/core/services/tests/identity_test.go +++ b/internal/core/services/tests/identity_test.go @@ -45,17 +45,8 @@ func Test_identity_UpdateState(t *testing.T) { identity, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) - - identity2, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) - require.NoError(t, err) - schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" did, err := w3c.ParseDID(identity.Identifier) - assert.NoError(t, err) - did2, err := w3c.ParseDID(identity2.Identifier) - assert.NoError(t, err) - did3, err := w3c.ParseDID("did:polygonid:polygon:mumbai:2qD6cqGpLX2dibdFuKfrPxGiybi3wKa8RbR4onw49H") - assert.NoError(t, err) credentialSubject := map[string]any{ "id": "did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ", "birthday": 19960424, @@ -63,53 +54,109 @@ func Test_identity_UpdateState(t *testing.T) { } typeC := "KYCAgeCredential" - merklizedRootPosition := "index" - _, err = claimsService.Save(context.Background(), ports.NewCreateClaimRequest(did, schema, credentialSubject, common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, common.ToPointer(true), common.ToPointer(true), nil, false, verifiable.SparseMerkleTreeProof, nil, nil, nil)) - assert.NoError(t, err) - - type testConfig struct { - name string - did *w3c.DID - shouldReturnErr bool - } - - for _, tc := range []testConfig{ - { - name: "should get a new state for identity with a claim", - did: did, - shouldReturnErr: false, - }, - { - name: "should get a new state for identity without claim", - did: did2, - shouldReturnErr: true, - }, - { - name: "should return an error", - did: did3, - shouldReturnErr: true, - }, - } { - t.Run(tc.name, func(t *testing.T) { - previousStateIdentity, _ := identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, tc.did) - identityState, err := identityService.UpdateState(ctx, *tc.did) - if tc.shouldReturnErr { - assert.Error(t, err) - } else { - assert.NoError(t, err) - assert.NoError(t, err) - assert.Equal(t, tc.did.String(), identityState.Identifier) - assert.NotNil(t, identityState.State) - assert.Equal(t, domain.StatusCreated, identityState.Status) - assert.NotNil(t, identityState.StateID) - assert.Equal(t, previousStateIdentity.State, identityState.PreviousState) - assert.NotNil(t, identityState.RootOfRoots) - assert.NotNil(t, identityState.ClaimsTreeRoot) - assert.NotNil(t, identityState.RevocationTreeRoot) - assert.Equal(t, domain.StatusCreated, identityState.Status) - } - }) - } + t.Run("should update state", func(t *testing.T) { + ctx := context.Background() + merklizedRootPosition := "index" + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, + common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, + common.ToPointer(true), common.ToPointer(true), nil, false, + verifiable.SparseMerkleTreeProof, nil, nil, nil)) + + assert.NoError(t, err) + previousStateIdentity, _ := identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, did) + identityState, err := identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + assert.Equal(t, did.String(), identityState.Identifier) + assert.NotNil(t, identityState.State) + assert.Equal(t, domain.StatusCreated, identityState.Status) + assert.NotNil(t, identityState.StateID) + assert.Equal(t, previousStateIdentity.State, identityState.PreviousState) + assert.NotNil(t, identityState.RootOfRoots) + assert.NotNil(t, identityState.ClaimsTreeRoot) + assert.NotNil(t, identityState.RevocationTreeRoot) + }) + + t.Run("should update state for a new credential with mtp", func(t *testing.T) { + ctx := context.Background() + merklizedRootPosition := "index" + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, + common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, + common.ToPointer(false), common.ToPointer(true), nil, false, + verifiable.SparseMerkleTreeProof, nil, nil, nil)) + + assert.NoError(t, err) + previousStateIdentity, _ := identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, did) + identityState, err := identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + assert.Equal(t, did.String(), identityState.Identifier) + assert.NotNil(t, identityState.State) + assert.Equal(t, domain.StatusCreated, identityState.Status) + assert.NotNil(t, identityState.StateID) + assert.Equal(t, previousStateIdentity.State, identityState.PreviousState) + assert.NotNil(t, identityState.RootOfRoots) + assert.NotNil(t, identityState.ClaimsTreeRoot) + assert.NotNil(t, identityState.RevocationTreeRoot) + }) + + t.Run("should return an error after revoke a credential", func(t *testing.T) { + ctx := context.Background() + merklizedRootPosition := "index" + claim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, + common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, + common.ToPointer(false), common.ToPointer(true), nil, false, + verifiable.SparseMerkleTreeProof, nil, nil, nil)) + + assert.NoError(t, err) + previousStateIdentity, _ := identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, did) + identityState, err := identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + assert.Equal(t, did.String(), identityState.Identifier) + assert.NotNil(t, identityState.State) + assert.Equal(t, domain.StatusCreated, identityState.Status) + assert.NotNil(t, identityState.StateID) + assert.Equal(t, previousStateIdentity.State, identityState.PreviousState) + assert.NotNil(t, identityState.RootOfRoots) + assert.NotNil(t, identityState.ClaimsTreeRoot) + assert.NotNil(t, identityState.RevocationTreeRoot) + + assert.NoError(t, claimsService.Revoke(ctx, *did, uint64(claim.RevNonce), "")) + _, err = identityService.UpdateState(ctx, *did) + assert.Error(t, err) + }) + + t.Run("should get an error creating credential with sig proof", func(t *testing.T) { + ctx := context.Background() + merklizedRootPosition := "index" + _, err = claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, + common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, + common.ToPointer(true), common.ToPointer(false), nil, false, + verifiable.SparseMerkleTreeProof, nil, nil, nil)) + + assert.NoError(t, err) + _, err = identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, did) + assert.NoError(t, err) + _, err = identityService.UpdateState(ctx, *did) + assert.Error(t, err) + }) + + t.Run("should update state after revoke credential with sig proof", func(t *testing.T) { + ctx := context.Background() + merklizedRootPosition := "index" + claim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, + common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, + common.ToPointer(true), common.ToPointer(false), nil, false, + verifiable.SparseMerkleTreeProof, nil, nil, nil)) + + assert.NoError(t, err) + _, err = identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, did) + assert.NoError(t, err) + _, err = identityService.UpdateState(ctx, *did) + assert.Error(t, err) + + assert.NoError(t, claimsService.Revoke(ctx, *did, uint64(claim.RevNonce), "")) + _, err = identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + }) } func Test_identity_GetByDID(t *testing.T) { diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index a1161f263..6f8bad38e 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -584,7 +584,8 @@ func (c *claims) GetAllByState(ctx context.Context, conn db.Querier, did *w3c.DI core_claim FROM claims LEFT OUTER JOIN identity_states ON claims.identity_state = identity_states.state - WHERE issuer = $1 AND identity_state = $2 AND claims.identifier = issuer AND (mtp = true OR revoked = true) + WHERE issuer = $1 AND ((identity_state IS NULL AND (mtp = true OR revoked = true) OR (identity_state = $2 AND mtp = true))) + AND claims.identifier = issuer `, did.String(), state.Hex()) } From b72dbbd0e2beaac8fb02496ecf27fa7f1effd5b2 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 5 Apr 2024 07:50:12 -0300 Subject: [PATCH 097/110] chore: improve code --- internal/core/services/identity.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index f3523e860..a3b681434 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -404,8 +404,10 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi return newState, err } +// checkClaimsToAdd checks if there are claims to process +// if the len of the claims is 0 or the len is 1 and the claim is the authBJJCredential then return an error func checkClaimsToAdd(lc []domain.Claim, authCoreClaim string) error { - if len(lc) == 0 || len(lc) == 1 && lc[0].SchemaType == authCoreClaim { + if len(lc) == 0 || (len(lc) == 1 && lc[0].SchemaType == authCoreClaim) { return ErrNoClaimsFoundToProcess } return nil From 1b155c1bc2031a22101081fde9d1cc0049ffdd31 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Fri, 5 Apr 2024 08:23:40 -0300 Subject: [PATCH 098/110] chore: improve code --- internal/core/services/identity.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index a3b681434..39e876413 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -310,7 +310,6 @@ func (i *identity) GetKeyIDFromAuthClaim(ctx context.Context, authClaim *domain. } func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.IdentityState, error) { - const authBJJCredential = "https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential" newState := &domain.IdentityState{ Identifier: did.String(), Status: domain.StatusCreated, @@ -339,7 +338,7 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi } // Check if there are claims to process - if err := checkClaimsToAdd(lc, authBJJCredential); err != nil { + if err := checkClaimsToAdd(lc); err != nil { return err } @@ -406,8 +405,12 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi // checkClaimsToAdd checks if there are claims to process // if the len of the claims is 0 or the len is 1 and the claim is the authBJJCredential then return an error -func checkClaimsToAdd(lc []domain.Claim, authCoreClaim string) error { - if len(lc) == 0 || (len(lc) == 1 && lc[0].SchemaType == authCoreClaim) { +func checkClaimsToAdd(lc []domain.Claim) error { + if len(lc) == 0 { + return ErrNoClaimsFoundToProcess + } + + if len(lc) == 1 && lc[0].SchemaType == domain.AuthBJJCredentialTypeID { return ErrNoClaimsFoundToProcess } return nil From 3e13c170d39c0b15527ccc714f615fad4715481d Mon Sep 17 00:00:00 2001 From: Javi Date: Mon, 8 Apr 2024 14:10:55 +0200 Subject: [PATCH 099/110] feat: adding amoy support (#645) * feat: adding amoy support * docs: adding new contracts --- .env-api.sample | 2 +- .env-issuer.sample | 9 +++---- .env-ui.sample | 2 +- README.md | 6 ++--- api/api.yaml | 4 +-- api_ui/api.yaml | 12 ++++----- go.mod | 22 ++++++++-------- go.sum | 45 ++++++++++++++++++--------------- internal/api/api.gen.go | 2 +- internal/api/server_test.go | 36 +++++++++++++++++++++++++- internal/config/config.go | 6 ++--- k8s/helm/readme.md | 4 +-- k8s/helm/templates/_helpers.tpl | 10 ++++---- k8s/helm/values.yaml | 6 ++++- tools/vault-migrator/readme.md | 2 +- 15 files changed, 104 insertions(+), 64 deletions(-) diff --git a/.env-api.sample b/.env-api.sample index b1df75213..48a8a028e 100644 --- a/.env-api.sample +++ b/.env-api.sample @@ -8,7 +8,7 @@ ISSUER_API_UI_ISSUER_DID= ISSUER_API_UI_SCHEMA_CACHE=false ISSUER_API_IDENTITY_METHOD=polygonid ISSUER_API_IDENTITY_BLOCKCHAIN=polygon -ISSUER_API_IDENTITY_NETWORK=mumbai +ISSUER_API_IDENTITY_NETWORK=amoy ISSUER_API_UI_KEY_TYPE=BJJ ISSUER_API_ENVIRONMENT=local ISSUER_CUSTOM_DID_METHODS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' diff --git a/.env-issuer.sample b/.env-issuer.sample index c45fa23c1..1c45a6a0d 100644 --- a/.env-issuer.sample +++ b/.env-issuer.sample @@ -17,7 +17,7 @@ ISSUER_KEY_STORE_PLUGIN_IDEN3_MOUNT_PATH=iden3 ISSUER_ETHEREUM_URL= -ISSUER_ETHEREUM_CONTRACT_ADDRESS=0x134B1BE34911E39A8397ec6289782989729807a4 +ISSUER_ETHEREUM_CONTRACT_ADDRESS=0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124 ISSUER_ETHEREUM_DEFAULT_GAS_LIMIT=600000 ISSUER_ETHEREUM_CONFIRMATION_TIME_OUT=600s ISSUER_ETHEREUM_CONFIRMATION_BLOCK_COUNT=5 @@ -27,8 +27,7 @@ ISSUER_ETHEREUM_MAX_GAS_PRICE=1000000 ISSUER_ETHEREUM_RPC_RESPONSE_TIMEOUT=5s ISSUER_ETHEREUM_WAIT_RECEIPT_CYCLE_TIME=30s ISSUER_ETHEREUM_WAIT_BLOCK_CYCLE_TIME=30s -ISSUER_ETHEREUM_RESOLVER_PREFIX=polygon:mumbai -ISSUER_ETHEREUM_INTERNAL_TRANSFER_AMOUNT_WEI=1000000000000000000 +ISSUER_ETHEREUM_RESOLVER_PREFIX=polygon:amoy ISSUER_ETHEREUM_TRANSFER_ACCOUNT_KEY_PATH=pbkey ISSUER_PROVER_SERVER_URL=http://localhost:8002 @@ -42,8 +41,8 @@ ISSUER_VAULT_USERPASS_AUTH_ENABLED=false ISSUER_VAULT_USERPASS_AUTH_PASSWORD=password -ISSUER_CREDENTIAL_STATUS_ONCHAIN_TREE_STORE_SUPPORTED_CONTRACT= +ISSUER_CREDENTIAL_STATUS_ONCHAIN_TREE_STORE_SUPPORTED_CONTRACT=0x3d3763eC0a50CE1AdF83d0b5D99FBE0e3fEB43fb ISSUER_CREDENTIAL_STATUS_RHS_URL=http://localhost:3001 ISSUER_CREDENTIAL_STATUS_PUBLISHING_KEY_PATH=pbkey ISSUER_CREDENTIAL_STATUS_RHS_MODE=None -ISSUER_CREDENTIAL_STATUS_RHS_CHAIN_ID=<80001 | 137> \ No newline at end of file +ISSUER_CREDENTIAL_STATUS_RHS_CHAIN_ID=<80002 | 80001 | 137> \ No newline at end of file diff --git a/.env-ui.sample b/.env-ui.sample index f86e6eee6..6f6e4f30e 100644 --- a/.env-ui.sample +++ b/.env-ui.sample @@ -1,6 +1,6 @@ ISSUER_UI_AUTH_USERNAME=user-ui ISSUER_UI_AUTH_PASSWORD=password-ui -ISSUER_UI_BLOCK_EXPLORER_URL=https://mumbai.polygonscan.com +ISSUER_UI_BLOCK_EXPLORER_URL=https://www.oklink.com/amoy ISSUER_UI_BUILD_TAG= ISSUER_UI_WARNING_MESSAGE= ISSUER_UI_IPFS_GATEWAY_URL=https://ipfs.io diff --git a/README.md b/README.md index 19869c360..6af4e115b 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Streamline the **Verifiable Credentials issuance** process with the user-friendl - [Docker Engine](https://docs.docker.com/engine/) `1.27+` - Makefile toolchain `GNU Make 3.81` - Publicly accessible URL - The issuer node API must be publicly reachable. Please make sure you properly configure your proxy or use a tool like [Localtunnel](https://theboroer.github.io/localtunnel-www/) for testing purposes. -- Polygon Mumbai or Main RPC - You can get one in any of the providers of this list +- Polygon Amoy or Main RPC - You can get one in any of the providers of this list - [Chainstack](https://chainstack.com/) - [Ankr](https://ankr.com/) - [QuickNode](https://quicknode.com/) @@ -54,7 +54,7 @@ Streamline the **Verifiable Credentials issuance** process with the user-friendl In this section we will cover the installation of the Issuer Node API. > [!NOTE] -> This Quick Installation Guide is prepared for Polygon Mumbai (Testnet) both for the state contract and issuer dids. If you want to deploy the node with Polygon Main configuration, please visit our [advanced Issuer Node configuration guide](https://devs.polygonid.com/docs/issuer/issuer-configuration/)). +> This Quick Installation Guide is prepared for Polygon Amoy (Testnet) both for the state contract and issuer dids. If you want to deploy the node with Polygon Main configuration, please visit our [advanced Issuer Node configuration guide](https://devs.polygonid.com/docs/issuer/issuer-configuration/)). #### Deploy Issuer Node Infrastructure @@ -84,7 +84,7 @@ In this section we will cover the installation of the Issuer Node API. make add-vault-token ``` -5. Write the private key in the vault. This step is needed in order to be able to transit the issuer's state. To perform that action the given account has to be funded. For Mumbai network you can request some testing Matic [here](https://mumbaifaucet.com/). +5. Write the private key in the vault. This step is needed in order to be able to transit the issuer's state. To perform that action the given account has to be funded. For Amoy network you can request some testing Matic [here](https://www.alchemy.com/faucets/polygon-amoy). ```bash make private_key= add-private-key diff --git a/api/api.yaml b/api/api.yaml index d72a09779..46c93a13a 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -262,7 +262,7 @@ paths: name: subject schema: type: string - description: Filter per subject. Example - did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ + description: Filter per subject. Example - did:polygonid:polygon:amoy:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ - in: query name: revoked schema: @@ -519,7 +519,7 @@ components: network: type: string x-omitempty: false - example: "mumbai" + example: "amoy" type: type: string x-omitempty: false diff --git a/api_ui/api.yaml b/api_ui/api.yaml index d74a52c83..2ebe3b36d 100644 --- a/api_ui/api.yaml +++ b/api_ui/api.yaml @@ -330,7 +330,7 @@ paths: name: did schema: type: string - example: did:polygonid:polygon:mumbai:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe + example: did:polygonid:polygon:amoy:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe - in: query name: status schema: @@ -1085,7 +1085,7 @@ components: example: [ ] from: type: string - example: did:polygonid:polygon:mumbai:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe + example: did:polygonid:polygon:amoy:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe QrCodeLinkShortResponse: type: object @@ -1283,10 +1283,10 @@ components: example: birthday: 19960424 documentType: 2 - id: "did:polygonid:polygon:mumbai:2qDDDKmo436EZGCBAvkqZjADYoNRJszkG7UymZeCHQ" + id: "did:polygonid:polygon:amoy:2qDDDKmo436EZGCBAvkqZjADYoNRJszkG7UymZeCHQ" userID: type: string - example: did:polygonid:polygon:mumbai:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe + example: did:polygonid:polygon:amoy:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe refreshService: $ref: '#/components/schemas/RefreshService' displayMethod: @@ -1493,11 +1493,11 @@ components: userID: type: string x-omitempty: false - example: did:polygonid:polygon:mumbai:2qMZrfBsXuGFTwSqkqYki78zF3pe1vtXoqH4yRLsfs + example: did:polygonid:polygon:amoy:2qMZrfBsXuGFTwSqkqYki78zF3pe1vtXoqH4yRLsfs issuerID: type: string x-omitempty: false - example: did:polygonid:polygon:mumbai:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe + example: did:polygonid:polygon:amoy:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe createdAt: $ref: '#/components/schemas/TimeUTC' credentials: diff --git a/go.mod b/go.mod index 92df6a5ad..cee7927b7 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/alicebob/miniredis/v2 v2.31.1 github.com/deepmap/oapi-codegen v1.16.2 - github.com/ethereum/go-ethereum v1.13.13 + github.com/ethereum/go-ethereum v1.13.14 github.com/getkin/kin-openapi v0.123.0 github.com/go-chi/chi/v5 v5.0.11 github.com/go-chi/cors v1.2.1 @@ -20,7 +20,7 @@ require ( github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f github.com/iden3/go-circuits/v2 v2.0.1 github.com/iden3/go-iden3-auth/v2 v2.1.0 - github.com/iden3/go-iden3-core/v2 v2.0.4 + github.com/iden3/go-iden3-core/v2 v2.1.0 github.com/iden3/go-iden3-crypto v0.0.16 github.com/iden3/go-jwz/v2 v2.0.1 github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 @@ -50,8 +50,8 @@ require ( github.com/pressly/goose/v3 v3.17.0 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 - golang.org/x/crypto v0.19.0 - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 + golang.org/x/crypto v0.22.0 + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 ) require github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect @@ -112,12 +112,12 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dchest/blake512 v1.0.0 // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 // indirect github.com/esimonov/ifshort v1.0.4 // indirect - github.com/ethereum/c-kzg-4844 v0.4.0 // indirect + github.com/ethereum/c-kzg-4844 v1.0.1 // indirect github.com/ettle/strcase v0.2.0 // indirect github.com/fatih/color v1.16.0 // indirect github.com/fatih/structtag v1.2.0 // indirect @@ -324,13 +324,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 // indirect - golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.18.0 // indirect + golang.org/x/tools v0.20.0 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 458002efe..58b7286f8 100644 --- a/go.sum +++ b/go.sum @@ -197,6 +197,8 @@ github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041 h1:44imsFSR7Hc github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= +github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= @@ -213,8 +215,9 @@ github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80N github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/deepmap/oapi-codegen v1.16.2 h1:xGHx0dNqYfy9gE8a7AVgVM8Sd5oF9SEgePzP+UPAUXI= github.com/deepmap/oapi-codegen v1.16.2/go.mod h1:rdYoEA2GE+riuZ91DvpmBX9hJbQpuY9wchXpfQ3n+ho= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= @@ -243,10 +246,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= -github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= -github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.13.13 h1:KYn9w7pEWRI9oyZOzO94OVbctSusPByHdFDPj634jII= -github.com/ethereum/go-ethereum v1.13.13/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= +github.com/ethereum/c-kzg-4844 v1.0.1 h1:pGixCbGizcVKSwoV70ge48+PrbB+iSKs2rjgfE4yJmQ= +github.com/ethereum/c-kzg-4844 v1.0.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ= +github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -537,8 +540,8 @@ github.com/iden3/go-iden3-auth/v2 v2.1.0 h1:e+oRhPyJ14dbwDjAnYrp1O+PvtzzzhOLxLqF github.com/iden3/go-iden3-auth/v2 v2.1.0/go.mod h1:KpKzSa5ANat+mSMTUzBZwQZ5NTI6w8Q4L0yVxQdnyVc= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= -github.com/iden3/go-iden3-core/v2 v2.0.4 h1:ggzC2zgOWgJAAcuG9X8bQG1r4gAoHZWqY7aLV8b1qgc= -github.com/iden3/go-iden3-core/v2 v2.0.4/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= +github.com/iden3/go-iden3-core/v2 v2.1.0 h1:R1s7Tj3tIx5lDy8S7OJrSNuxXIFeRzWRmTBaQoQHJps= +github.com/iden3/go-iden3-core/v2 v2.1.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.16 h1:zN867xiz6HgErXVIV/6WyteGcOukE9gybYTorBMEdsk= github.com/iden3/go-iden3-crypto v0.0.16/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= github.com/iden3/go-jwz/v2 v2.0.1 h1:y8HccYGaI5JULVTOfKRPsQ2pGRx8pfgkdCz0kQA8jQE= @@ -1174,8 +1177,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1186,8 +1189,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 h1:UhRVJ0i7bF9n/Hd8YjW3eKjlPVBHzbQdxrBgjbSKl64= @@ -1222,8 +1225,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1269,8 +1272,8 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1290,8 +1293,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1365,8 +1368,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1466,8 +1469,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/api/api.gen.go b/internal/api/api.gen.go index 03fc256f8..a09192c20 100644 --- a/internal/api/api.gen.go +++ b/internal/api/api.gen.go @@ -277,7 +277,7 @@ type GetClaimsParams struct { // SchemaHash Filter per schema hash. Example - c9b2370371b7fa8b3dab2a5ba81b6838 SchemaHash *string `form:"schemaHash,omitempty" json:"schemaHash,omitempty"` - // Subject Filter per subject. Example - did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ + // Subject Filter per subject. Example - did:polygonid:polygon:amoy:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ Subject *string `form:"subject,omitempty" json:"subject,omitempty"` // Revoked Filter per claims revoked or not - Example - true. diff --git a/internal/api/server_test.go b/internal/api/server_test.go index 958182d4e..d247e38de 100644 --- a/internal/api/server_test.go +++ b/internal/api/server_test.go @@ -13,6 +13,7 @@ import ( commonEth "github.com/ethereum/go-ethereum/common" "github.com/google/uuid" + core "github.com/iden3/go-iden3-core/v2" "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/iden3/iden3comm/v2/packers" @@ -77,6 +78,38 @@ func TestServer_CreateIdentity(t *testing.T) { httpCode: http.StatusUnauthorized, }, }, + { + name: "should create a BJJ identity for amoy network", + auth: authOk, + input: CreateIdentityRequest{ + DidMetadata: struct { + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: blockchain, Method: method, Network: string(core.Amoy), Type: BJJ}, + }, + expected: expected{ + httpCode: 201, + message: nil, + }, + }, + { + name: "should create a ETH identity for amoy network", + auth: authOk, + input: CreateIdentityRequest{ + DidMetadata: struct { + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: blockchain, Method: method, Network: string(core.Amoy), Type: ETH}, + }, + expected: expected{ + httpCode: 201, + message: nil, + }, + }, { name: "should create a BJJ identity", auth: authOk, @@ -185,11 +218,12 @@ func TestServer_CreateIdentity(t *testing.T) { case http.StatusCreated: var response CreateIdentityResponse require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + require.NotNil(t, response.Identifier) + assert.Contains(t, *response.Identifier, tc.input.DidMetadata.Network) assert.NotNil(t, response.State.CreatedAt) assert.NotNil(t, response.State.ModifiedAt) assert.NotNil(t, response.State.State) assert.NotNil(t, response.State.Status) - assert.NotNil(t, *response.Identifier) if tc.input.DidMetadata.Type == BJJ { assert.NotNil(t, *response.State.ClaimsTreeRoot) } diff --git a/internal/config/config.go b/internal/config/config.go index 3299706d1..938ef8677 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -88,7 +88,7 @@ type Ethereum struct { RPCResponseTimeout time.Duration `tip:"RPC Response timeout"` WaitReceiptCycleTime time.Duration `tip:"Wait Receipt Cycle Time"` WaitBlockCycleTime time.Duration `tip:"Wait Block Cycle Time"` - ResolverPrefix string `tip:"blockchain:network e.g polygon:mumbai"` + ResolverPrefix string `tip:"blockchain:network e.g polygon:amoy"` InternalTransferAmountWei int64 `tip:"Internal transfer amount in wei"` TransferAccountKeyPath string `tip:"Transfer account key path"` } @@ -674,8 +674,8 @@ func checkEnvVars(ctx context.Context, cfg *Configuration) { } if cfg.APIUI.IdentityNetwork == "" { - log.Info(ctx, "ISSUER_API_IDENTITY_NETWORK value is missing and the server set up it as mumbai") - cfg.APIUI.IdentityNetwork = "mumbai" + log.Info(ctx, "ISSUER_API_IDENTITY_NETWORK value is missing and the server set up it as amoy") + cfg.APIUI.IdentityNetwork = "amoy" } } diff --git a/k8s/helm/readme.md b/k8s/helm/readme.md index b878d5526..ce69d44a6 100644 --- a/k8s/helm/readme.md +++ b/k8s/helm/readme.md @@ -31,10 +31,10 @@ export UI_DOMAIN=ui.example.com # Domain for the UI. To export API_DOMAIN=api.example.com # Domain for the API.To use this INGRESS_ENABLED must be true export PRIVATE_KEY='YOUR PRIVATE KEY' # Private key of the wallet (Metamask private key wallet). export PUBLIC_IP='YOUR PUBLIC IP' # Provide the PUBLIC IP if you have any otherwise leave this field. -export MAINNET=false # Specify if the network is main, if this value is false issuer node will use mumbai +export MAINNET=false # Specify if the network is main, if this value is false issuer node will use amoy export UIPASSWORD="my ui password" # Password for user: ui-user. This password is used when the user visit the ui. export ISSUERNAME="My Issuer" # Issuer Name. This value is shown in the UI -export ISSUER_ETHERUM_URL="https://polygon-mumbai.XXXX" # Blockchain RPC. +export ISSUER_ETHERUM_URL="https://polygon-amoy.XXXX" # Blockchain RPC. export INGRESS_ENABLED=true # If this value is false you must provide a STATIC_IP export VAULT_PWD=password # Vault password. export RHS_MODE=None # Reverse Hash Service mode. Options: None, OnChain, OffChain diff --git a/k8s/helm/templates/_helpers.tpl b/k8s/helm/templates/_helpers.tpl index 8cbbddb81..a2038e150 100644 --- a/k8s/helm/templates/_helpers.tpl +++ b/k8s/helm/templates/_helpers.tpl @@ -72,7 +72,7 @@ Define contract address {{- if eq .Values.mainnet true }} {{ .Values.apiIssuerNode.configMap.issuerEthereumContractAddressMain }} {{- else }} -{{ .Values.apiIssuerNode.configMap.issuerEthereumContractAddressMumbai }} +{{ .Values.apiIssuerNode.configMap.issuerEthereumContractAddressAmoy }} {{- end }} {{- end }} @@ -83,7 +83,7 @@ Define ethereum resolver prefix {{- if eq .Values.mainnet true }} {{ .Values.apiIssuerNode.configMap.issuerEthereumResolverPrefixMain }} {{- else }} -{{ .Values.apiIssuerNode.configMap.issuerEthereumResolverPrefixMumbai }} +{{ .Values.apiIssuerNode.configMap.issuerEthereumResolverPrefixAmoy }} {{- end }} {{- end }} @@ -94,7 +94,7 @@ Define network {{- if eq .Values.mainnet true }} {{ .Values.apiUiIssuerNode.configMap.issuerApiIdentityNetworkMain }} {{- else }} -{{ .Values.apiUiIssuerNode.configMap.issuerApiIdentityNetworkMumbai }} +{{ .Values.apiUiIssuerNode.configMap.issuerApiIdentityNetworkAmoy }} {{- end }} {{- end }} @@ -127,7 +127,7 @@ Define block explorer {{- if eq .Values.mainnet true }} {{ .Values.uiIssuerNode.configMap.issuerUiBlockExplorerUrlMain }} {{- else }} -{{ .Values.uiIssuerNode.configMap.issuerUiBlockExplorerUrlMumbai }} +{{ .Values.uiIssuerNode.configMap.issuerUiBlockExplorerUrlAmoy }} {{- end }} {{- end }} @@ -138,7 +138,7 @@ Define RHS_CHAIN_ID {{- if eq .Values.mainnet true }} "137" {{- else }} -"80001" +"80002" {{- end }} {{- end }} diff --git a/k8s/helm/values.yaml b/k8s/helm/values.yaml index 6d5f4c442..3a77404f8 100644 --- a/k8s/helm/values.yaml +++ b/k8s/helm/values.yaml @@ -51,12 +51,14 @@ apiIssuerNode: issuerEthereumConfirmationBlockCount: "10" issuerEthereumConfirmationTimeOut: 10s issuerEthereumContractAddressMumbai: "0x134B1BE34911E39A8397ec6289782989729807a4" + issuerEthereumContractAddressAmoy: "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124" issuerEthereumContractAddressMain: "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D" issuerEthereumDefaultGasLimit: "600000" issuerEthereumMaxGasPrice: "1000000" issuerEthereumMinGasPrice: "0" issuerEthereumReceiptTimeout: 600s issuerEthereumResolverPrefixMumbai: polygon:mumbai + issuerEthereumResolverPrefixAmoy: polygon:amoy issuerEthereumResolverPrefixMain: polygon:main issuerEthereumRpcResponseTimeout: 5s issuerEthereumWaitBlockCycleTime: 30s @@ -131,6 +133,7 @@ apiUiIssuerNode: issuerApiIdentityBlockchain: polygon issuerApiIdentityMethod: polygonid issuerApiIdentityNetworkMumbai: mumbai + issuerApiIdentityNetworkAmoy: amoy issuerApiIdentityNetworkMain: main issuerApiUiAuthPassword: password-api issuerApiUiAuthUser: user-api @@ -196,6 +199,7 @@ uiIssuerNode: issuerApiUiIssuerName: my issuer k8s issuerUiAuthUsername: user-ui issuerUiBlockExplorerUrlMumbai: https://mumbai.polygonscan.com + issuerUiBlockExplorerUrlAmoy: https://www.oklink.com/amoy‍ issuerUiBlockExplorerUrlMain: https://polygonscan.com/ issuerUiIpfsGatewayUrl: https://ipfs.io issuerApiUiName: issuer-node-ui-configmap @@ -451,7 +455,7 @@ uidomain: ui.issuernode.polygonid.me appdomain: app.issuernode.polygonid.me apidomain: api.issuernode.polygonid.me -issuerEthereumUrl: https://polygon-mumbai.g.alchemy.com/v2/ +issuerEthereumUrl: https://polygon-amoy.g.alchemy.com/v2/ mainnet: false publicIP: nil uiPassword: password diff --git a/tools/vault-migrator/readme.md b/tools/vault-migrator/readme.md index a11fe0a43..f04742f52 100644 --- a/tools/vault-migrator/readme.md +++ b/tools/vault-migrator/readme.md @@ -16,7 +16,7 @@ the command above will export all keys from Vault to a file called **keys.json** Alternatively, you can specify **a did** to export only the keys that match the did ```bash -go run ./tools/vault-migrator/main.go -operation=export -input-file=keys.json -vault-token=your-vault-token -vault-addr=http://localhost:8200 -did=did:polygonid:polygon:mumbai:2qPHBiiu1wJN3rCMaaXwJpm9mNvuNqZZukzqS3V4Jg +go run ./tools/vault-migrator/main.go -operation=export -input-file=keys.json -vault-token=your-vault-token -vault-addr=http://localhost:8200 -did=did:polygonid:polygon:amoy:2qPHBiiu1wJN3rCMaaXwJpm9mNvuNqZZukzqS3V4Jg ``` ### How to import keys to Vault From 0bb364ad159b01b76289d416a0a9e5f85a2c5fec Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Mon, 8 Apr 2024 17:02:25 -0300 Subject: [PATCH 100/110] fix: publish state and improve performance when processing takes place --- internal/core/services/identity.go | 64 ++++++++++--------- internal/core/services/tests/identity_test.go | 51 ++++++++++++++- internal/gateways/publisher.go | 1 + internal/repositories/claims.go | 2 +- 4 files changed, 86 insertions(+), 32 deletions(-) diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index 39e876413..448aa4778 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -56,7 +56,7 @@ var ( // ErrAssigningMTPProof - represents an error in the identity metadata ErrAssigningMTPProof = errors.New("error assigning the MTP Proof from Auth Claim. If this identity has keyType=ETH you must to publish the state first") // ErrNoClaimsFoundToProcess - means that there are no claims to process - ErrNoClaimsFoundToProcess = errors.New("no MTP claims found to process") + ErrNoClaimsFoundToProcess = errors.New("no MTP or revoked claims found to process") ) type identity struct { @@ -327,42 +327,35 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi return fmt.Errorf("error getting the identifier last state: %w", err) } - var state *merkletree.Hash = nil - if previousState != nil { - state = previousState.TreeState().State - } - - lc, err := i.claimsRepository.GetAllByState(ctx, tx, &did, state) + // Get all mtp claims with state == nil + claimsAddedToTree, err := i.processClaims(ctx, tx, did, iTrees) if err != nil { - return fmt.Errorf("error getting the states: %w", err) + return err } - // Check if there are claims to process - if err := checkClaimsToAdd(lc); err != nil { + // Get all revocations with domain.RevPending status + updatedRevocations, err := i.revocationRepository.UpdateStatus(ctx, tx, &did) + if err != nil { + log.Error(ctx, "updating revocation status", "err", err) return err } - for i := range lc { - if lc[i].IdentityState == nil { - err = iTrees.AddClaim(ctx, &lc[i]) - if err != nil { - return err - } - } + log.Info(ctx, "updating revocation status", "revocations", len(updatedRevocations)) + + if len(updatedRevocations) == 0 && !claimsAddedToTree { + log.Info(ctx, "no claims or revocations found to process") + return ErrNoClaimsFoundToProcess } err = populateIdentityState(ctx, iTrees, newState, previousState) if err != nil { + log.Error(ctx, "populating identity state", "err", err) return err } err = i.update(ctx, tx, &did, *newState) if err != nil { - return err - } - - updatedRevocations, err := i.revocationRepository.UpdateStatus(ctx, tx, &did) - if err != nil { + log.Error(ctx, "updating claims", "err", err) return err } @@ -403,17 +396,28 @@ func (i *identity) UpdateState(ctx context.Context, did w3c.DID) (*domain.Identi return newState, err } -// checkClaimsToAdd checks if there are claims to process -// if the len of the claims is 0 or the len is 1 and the claim is the authBJJCredential then return an error -func checkClaimsToAdd(lc []domain.Claim) error { - if len(lc) == 0 { - return ErrNoClaimsFoundToProcess +func (i *identity) processClaims(ctx context.Context, tx pgx.Tx, did w3c.DID, iTrees *domain.IdentityMerkleTrees) (bool, error) { + lc, err := i.claimsRepository.GetAllByState(ctx, tx, &did, nil) + if err != nil { + return false, fmt.Errorf("error getting the states: %w", err) } - if len(lc) == 1 && lc[0].SchemaType == domain.AuthBJJCredentialTypeID { - return ErrNoClaimsFoundToProcess + claimsAddedToTree := false + if len(lc) > 0 { + log.Info(ctx, "adding claims to tree", "claims", len(lc)) + claimsAddedToTree = true } - return nil + + if claimsAddedToTree { + for i := range lc { + err = iTrees.AddClaim(ctx, &lc[i]) + if err != nil { + log.Error(ctx, "adding claim to tree", "err", err) + return false, err + } + } + } + return claimsAddedToTree, nil } func (i *identity) UpdateIdentityState(ctx context.Context, state *domain.IdentityState) error { diff --git a/internal/core/services/tests/identity_test.go b/internal/core/services/tests/identity_test.go index 41db65e54..c527bf507 100644 --- a/internal/core/services/tests/identity_test.go +++ b/internal/core/services/tests/identity_test.go @@ -98,7 +98,7 @@ func Test_identity_UpdateState(t *testing.T) { assert.NotNil(t, identityState.RevocationTreeRoot) }) - t.Run("should return an error after revoke a credential", func(t *testing.T) { + t.Run("should return success after revoke a MTP credential", func(t *testing.T) { ctx := context.Background() merklizedRootPosition := "index" claim, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, @@ -121,7 +121,56 @@ func Test_identity_UpdateState(t *testing.T) { assert.NoError(t, claimsService.Revoke(ctx, *did, uint64(claim.RevNonce), "")) _, err = identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + }) + + t.Run("should return pass after creating two credentials", func(t *testing.T) { + ctx := context.Background() + merklizedRootPosition := "index" + claimMTP, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, + common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, + common.ToPointer(false), common.ToPointer(true), nil, false, + verifiable.SparseMerkleTreeProof, nil, nil, nil)) + + assert.NoError(t, err) + previousStateIdentity, _ := identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, did) + identityState, err := identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + assert.Equal(t, did.String(), identityState.Identifier) + assert.NotNil(t, identityState.State) + assert.Equal(t, domain.StatusCreated, identityState.Status) + assert.NotNil(t, identityState.StateID) + assert.Equal(t, previousStateIdentity.State, identityState.PreviousState) + assert.NotNil(t, identityState.RootOfRoots) + assert.NotNil(t, identityState.ClaimsTreeRoot) + assert.NotNil(t, identityState.RevocationTreeRoot) + + assert.NoError(t, claimsService.Revoke(ctx, *did, uint64(claimMTP.RevNonce), "")) + _, err = identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + + claimSIG, err := claimsService.Save(ctx, ports.NewCreateClaimRequest(did, schema, credentialSubject, + common.ToPointer(time.Now()), typeC, nil, nil, &merklizedRootPosition, + common.ToPointer(true), common.ToPointer(false), nil, false, + verifiable.SparseMerkleTreeProof, nil, nil, nil)) + + assert.NoError(t, err) + _, err = identityService.UpdateState(ctx, *did) assert.Error(t, err) + + assert.NoError(t, claimsService.Revoke(ctx, *did, uint64(claimSIG.RevNonce), "")) + identityState, err = identityService.UpdateState(ctx, *did) + assert.NoError(t, err) + previousStateIdentity, err = identityStateRepo.GetLatestStateByIdentifier(ctx, storage.Pgx, did) + assert.NoError(t, err) + assert.Equal(t, did.String(), identityState.Identifier) + assert.NotNil(t, identityState.State) + assert.Equal(t, domain.StatusCreated, identityState.Status) + assert.NotNil(t, identityState.StateID) + assert.Equal(t, previousStateIdentity.State, identityState.PreviousState) + assert.NotNil(t, identityState.RootOfRoots) + assert.NotNil(t, identityState.ClaimsTreeRoot) + assert.NotNil(t, identityState.RevocationTreeRoot) }) t.Run("should get an error creating credential with sig proof", func(t *testing.T) { diff --git a/internal/gateways/publisher.go b/internal/gateways/publisher.go index 0ba60ded2..e4f854204 100644 --- a/internal/gateways/publisher.go +++ b/internal/gateways/publisher.go @@ -136,6 +136,7 @@ func (p *publisher) publishState(ctx context.Context, identifier *w3c.DID) (*dom txID, err := p.publishProof(ctx, identifier, *updatedState) if err != nil { + // TODO: Handle RHS status already published log.Error(ctx, "Error during publishing proof:", "err", err, "did", identifier.String()) updatedState.Status = domain.StatusFailed errUpdating := p.identityService.UpdateIdentityState(ctx, updatedState) diff --git a/internal/repositories/claims.go b/internal/repositories/claims.go index 6f8bad38e..e68a163a6 100644 --- a/internal/repositories/claims.go +++ b/internal/repositories/claims.go @@ -559,7 +559,7 @@ func (c *claims) GetAllByState(ctx context.Context, conn db.Querier, did *w3c.DI credential_status, core_claim FROM claims - WHERE issuer = $1 AND identity_state IS NULL AND identifier = issuer AND (mtp = true OR revoked = true) + WHERE issuer = $1 AND identity_state IS NULL AND identifier = issuer AND mtp = true `, did.String()) } else { rows, err = conn.Query(ctx, ` From 2b872e417cd5bbaa2db4b497a4ac0cb6ee2599f5 Mon Sep 17 00:00:00 2001 From: Javi Date: Wed, 10 Apr 2024 12:10:35 +0200 Subject: [PATCH 101/110] chore: updating protocol libraries (#651) * chore: updating protocol libraries * chore: updating dependencies * docs: updating sample file with proper Max Gas Price * chore: updating value issuerEthereumMaxGasPrice with Amoy price --- .env-issuer.sample | 2 +- go.mod | 47 +++++----- go.sum | 134 ++++++++++++--------------- internal/core/services/proof.go | 14 +-- internal/core/services/revocation.go | 21 +---- k8s/helm/values.yaml | 2 +- 6 files changed, 90 insertions(+), 130 deletions(-) diff --git a/.env-issuer.sample b/.env-issuer.sample index 1c45a6a0d..a1445d2d8 100644 --- a/.env-issuer.sample +++ b/.env-issuer.sample @@ -23,7 +23,7 @@ ISSUER_ETHEREUM_CONFIRMATION_TIME_OUT=600s ISSUER_ETHEREUM_CONFIRMATION_BLOCK_COUNT=5 ISSUER_ETHEREUM_RECEIPT_TIMEOUT=600s ISSUER_ETHEREUM_MIN_GAS_PRICE=0 -ISSUER_ETHEREUM_MAX_GAS_PRICE=1000000 +ISSUER_ETHEREUM_MAX_GAS_PRICE=2500000 ISSUER_ETHEREUM_RPC_RESPONSE_TIMEOUT=5s ISSUER_ETHEREUM_WAIT_RECEIPT_CYCLE_TIME=30s ISSUER_ETHEREUM_WAIT_BLOCK_CYCLE_TIME=30s diff --git a/go.mod b/go.mod index cee7927b7..afa5c4e17 100644 --- a/go.mod +++ b/go.mod @@ -18,11 +18,11 @@ require ( github.com/hashicorp/vault/api/auth/userpass v0.5.0 github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20231116131043-966af42c9b58 github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f - github.com/iden3/go-circuits/v2 v2.0.1 - github.com/iden3/go-iden3-auth/v2 v2.1.0 + github.com/iden3/go-circuits/v2 v2.2.0 + github.com/iden3/go-iden3-auth/v2 v2.2.2 github.com/iden3/go-iden3-core/v2 v2.1.0 github.com/iden3/go-iden3-crypto v0.0.16 - github.com/iden3/go-jwz/v2 v2.0.1 + github.com/iden3/go-jwz/v2 v2.0.2 github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 github.com/iden3/go-merkletree-sql/v2 v2.0.6 github.com/iden3/go-rapidsnark/prover v0.0.10 @@ -30,8 +30,8 @@ require ( github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 - github.com/iden3/go-schema-processor/v2 v2.2.0 - github.com/iden3/iden3comm/v2 v2.1.0 + github.com/iden3/go-schema-processor/v2 v2.3.3 + github.com/iden3/iden3comm/v2 v2.3.2 github.com/iden3/merkletree-proof v0.0.4 github.com/ipfs/go-ipfs-api v0.7.0 github.com/jackc/pgconn v1.14.1 @@ -49,9 +49,9 @@ require ( github.com/pkg/errors v0.9.1 github.com/pressly/goose/v3 v3.17.0 github.com/spf13/viper v1.18.2 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 golang.org/x/crypto v0.22.0 - golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 + golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 ) require github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect @@ -179,7 +179,7 @@ require ( github.com/iden3/go-rapidsnark/verifier v0.0.5 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/invopop/yaml v0.2.0 // indirect - github.com/ipfs/boxo v0.16.0 // indirect + github.com/ipfs/boxo v0.19.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -196,8 +196,8 @@ require ( github.com/kisielk/errcheck v1.7.0 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect - github.com/klauspost/compress v1.17.4 // indirect - github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/klauspost/compress v1.17.6 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/kulti/thelper v0.6.3 // indirect @@ -208,13 +208,13 @@ require ( github.com/leonklingele/grouper v1.1.1 // indirect github.com/lestrrat-go/blackmagic v1.0.2 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect - github.com/lestrrat-go/httprc v1.0.4 // indirect + github.com/lestrrat-go/httprc v1.0.5 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/jwx/v2 v2.0.18 // indirect + github.com/lestrrat-go/jwx/v2 v2.0.21 // indirect github.com/lestrrat-go/option v1.0.1 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.32.2 // indirect + github.com/libp2p/go-libp2p v0.33.2 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/macabu/inamedparam v0.1.3 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -225,7 +225,6 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.7 // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -235,7 +234,7 @@ require ( github.com/moricho/tparallel v0.3.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.12.1 // indirect + github.com/multiformats/go-multiaddr v0.12.3 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect @@ -252,8 +251,8 @@ require ( github.com/polyfloyd/go-errorlint v1.4.8 // indirect github.com/pquerna/cachecontrol v0.2.0 // indirect github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/common v0.47.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect @@ -289,14 +288,14 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.11 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.16 // indirect - github.com/tetratelabs/wazero v1.6.0 // indirect + github.com/tetratelabs/wazero v1.7.0 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect github.com/tklauser/go-sysconf v0.3.13 // indirect @@ -317,12 +316,12 @@ require ( github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.5 // indirect github.com/yuin/gopher-lua v1.1.0 // indirect - github.com/yusufpapurcu/wmi v1.2.3 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect gitlab.com/bosi/decorder v0.4.1 // indirect go-simpler.org/musttag v0.8.0 // indirect go-simpler.org/sloglint v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.26.0 // indirect + go.uber.org/zap v1.27.0 // indirect golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.24.0 // indirect @@ -331,13 +330,13 @@ require ( golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.20.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect - gopkg.in/go-jose/go-jose.v2 v2.6.2 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.4.6 // indirect - lukechampine.com/blake3 v1.2.1 // indirect + lukechampine.com/blake3 v1.2.2 // indirect mvdan.cc/gofumpt v0.6.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect diff --git a/go.sum b/go.sum index 58b7286f8..90c706b38 100644 --- a/go.sum +++ b/go.sum @@ -197,8 +197,6 @@ github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041 h1:44imsFSR7Hc github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= -github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= -github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= @@ -215,7 +213,6 @@ github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80N github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/deepmap/oapi-codegen v1.16.2 h1:xGHx0dNqYfy9gE8a7AVgVM8Sd5oF9SEgePzP+UPAUXI= @@ -303,8 +300,8 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -358,8 +355,6 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= -github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -450,8 +445,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= -github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 h1:E/LAvt58di64hlYjx7AsNS6C/ysHWYo+2qPCZKTQhRo= +github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= @@ -534,18 +529,18 @@ github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48/go.mod h1:kJmVPMk4HfWyl2kcta34aad/K4TAfCwB29xX9PsR7LQ= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f h1:aTYEBIh802oWF6B3jhXf5F7UVGxfPJG70shYkRXzb+s= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= -github.com/iden3/go-circuits/v2 v2.0.1 h1:tcJtBE8aLJsf9qpBoTUKE143Mne025cunQnSExMXaKo= -github.com/iden3/go-circuits/v2 v2.0.1/go.mod h1:VIFIp51+IH0hOzjnKhb84bCeyq7hq76zX/C14ua6zh4= -github.com/iden3/go-iden3-auth/v2 v2.1.0 h1:e+oRhPyJ14dbwDjAnYrp1O+PvtzzzhOLxLqFnqkoekE= -github.com/iden3/go-iden3-auth/v2 v2.1.0/go.mod h1:KpKzSa5ANat+mSMTUzBZwQZ5NTI6w8Q4L0yVxQdnyVc= +github.com/iden3/go-circuits/v2 v2.2.0 h1:qJeySVPG9vxZwJyL/CsvXdUhccWOctXQUYGnyX5p2Kc= +github.com/iden3/go-circuits/v2 v2.2.0/go.mod h1:1LET+T8i9Rkfx+RNj2BBHKAPGDODEWWwSEFjR6g3h6c= +github.com/iden3/go-iden3-auth/v2 v2.2.2 h1:4uA+m5H2OvhfOsMJaeXaCjciV2sHypvHgGHewZfXB58= +github.com/iden3/go-iden3-auth/v2 v2.2.2/go.mod h1:1ytFvnSnuNK2m9BoVrgYJoLNH919Bg2pt68pFelcJcM= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= github.com/iden3/go-iden3-core/v2 v2.1.0 h1:R1s7Tj3tIx5lDy8S7OJrSNuxXIFeRzWRmTBaQoQHJps= github.com/iden3/go-iden3-core/v2 v2.1.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.16 h1:zN867xiz6HgErXVIV/6WyteGcOukE9gybYTorBMEdsk= github.com/iden3/go-iden3-crypto v0.0.16/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= -github.com/iden3/go-jwz/v2 v2.0.1 h1:y8HccYGaI5JULVTOfKRPsQ2pGRx8pfgkdCz0kQA8jQE= -github.com/iden3/go-jwz/v2 v2.0.1/go.mod h1:+DRKSnFk3IsDvcKZA5EDeJFOSxjXm1kWAp588Kf+FN8= +github.com/iden3/go-jwz/v2 v2.0.2 h1:yx56x1TZcObeuj6cvX715Jd7QTxnCpHwbETKWCPJmhw= +github.com/iden3/go-jwz/v2 v2.0.2/go.mod h1:B1r6wJpPhIiuZTmgicNoogr7XD/VS3jZu9U519GwWz4= github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 h1:CKry110riXxBu1bM9vhdPia37tlbqoKYg0s0dwGA4l4= github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5/go.mod h1:J17cXiT4pBP/c5FWN4nv0J7q2yT9I8JSzUfdIKyZIj4= github.com/iden3/go-merkletree-sql/v2 v2.0.6 h1:vsVDImnvnHf7Ggr45ptFOXJyWNA/8IwVQO1jzRLUlY8= @@ -562,10 +557,10 @@ github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e/go.mod h1:UEBifEzw62T6VzIHJeHuUgeLg2U/J9ttf7hOwQEqnYk= github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFLPTEqnOIvlM= github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= -github.com/iden3/go-schema-processor/v2 v2.2.0 h1:sYPqLs72pEWXIfF0/MOv9AFm3+IGutRM3yClWRrjheg= -github.com/iden3/go-schema-processor/v2 v2.2.0/go.mod h1:Ovsrk0839NZgHtoW4hVLAmHoOsHAQZuVNUXd7sIOkLQ= -github.com/iden3/iden3comm/v2 v2.1.0 h1:op2X3y/H9khizcdoYKf3iRAQFt/l5dsip47sJu1kv7Q= -github.com/iden3/iden3comm/v2 v2.1.0/go.mod h1:G+ufR/M28O3PKMVrkUqCuoYfjiEkGFWvf8oF2BmFC6c= +github.com/iden3/go-schema-processor/v2 v2.3.3 h1:GfChxMZHG4miA3p/5rLIrM7TGmKu/oAAXgLloYTBHSI= +github.com/iden3/go-schema-processor/v2 v2.3.3/go.mod h1:8y/R0iQpYhyhRQ3sL4F5Aja3+1T68M6uwGQdC4pQ4X0= +github.com/iden3/iden3comm/v2 v2.3.2 h1:ulD0oI/+qsEmnHVELWrxdLNvQOOWr/JLVMFXzEVbr5E= +github.com/iden3/iden3comm/v2 v2.3.2/go.mod h1:HVdSjre4og+kdJ5Cqe2b3Dt2ccOogOdfyWwKaUSAelw= github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= github.com/iden3/merkletree-proof v0.0.4/go.mod h1:D49CVDG/tshMiZuDCxWjGJoNplRg9y9XIlg9/eMSYOc= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= @@ -574,8 +569,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= -github.com/ipfs/boxo v0.16.0 h1:A9dUmef5a+mEFki6kbyG7el5gl65CiUBzrDeZxzTWKY= -github.com/ipfs/boxo v0.16.0/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= +github.com/ipfs/boxo v0.19.0 h1:UbX9FBJQF19ACLqRZOgdEla6jR/sC4H1O+iGE0NToXA= +github.com/ipfs/boxo v0.19.0/go.mod h1:V5gJzbIMwKEXrg3IdvAxIdF7UPgU4RsXmNGS8MQ/0D4= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-ipfs-api v0.7.0 h1:CMBNCUl0b45coC+lQCXEVpMhwoqjiaCwUIrM+coYW2Q= @@ -677,10 +672,10 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= -github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= -github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= -github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/compress v1.17.6 h1:60eq2E/jlfwQXtvZEeBUYADs+BwKBWURIY+Gj2eRGjI= +github.com/klauspost/compress v1.17.6/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -716,13 +711,12 @@ github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= -github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/httprc v1.0.5 h1:bsTfiH8xaKOJPrg1R+E3iE/AWZr/x0Phj9PBTG/OLUk= +github.com/lestrrat-go/httprc v1.0.5/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.18 h1:HHZkYS5wWDDyAiNBwztEtDoX07WDhGEdixm8G06R50o= -github.com/lestrrat-go/jwx/v2 v2.0.18/go.mod h1:fAJ+k5eTgKdDqanzCuK6DAt3W7n3cs2/FX7JhQdk83U= -github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/lestrrat-go/jwx/v2 v2.0.21 h1:jAPKupy4uHgrHFEdjVjNkUgoBKtVDgrQPB/h55FHrR0= +github.com/lestrrat-go/jwx/v2 v2.0.21/go.mod h1:09mLW8zto6bWL9GbwnqAli+ArLf+5M33QLQPDggkUWM= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -735,8 +729,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6 github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.32.2 h1:s8GYN4YJzgUoyeYNPdW7JZeZ5Ee31iNaIBfGYMAY4FQ= -github.com/libp2p/go-libp2p v0.32.2/go.mod h1:E0LKe+diV/ZVJVnOJby8VC5xzHF0660osg71skcxJvk= +github.com/libp2p/go-libp2p v0.33.2 h1:vCdwnFxoGOXMKmaGHlDSnL4bM3fQeW8pgIa9DECnb40= +github.com/libp2p/go-libp2p v0.33.2/go.mod h1:zTeppLuCvUIkT118pFVzA8xzP/p2dJYOMApCkFh0Yww= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= @@ -774,8 +768,6 @@ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= @@ -811,8 +803,8 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk= -github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE= +github.com/multiformats/go-multiaddr v0.12.3 h1:hVBXvPRcKG0w80VinQ23P5t7czWgg65BmIvQKjDydU8= +github.com/multiformats/go-multiaddr v0.12.3/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= @@ -910,14 +902,14 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1: github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= -github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= +github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -1027,8 +1019,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1038,8 +1031,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= @@ -1056,8 +1050,8 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.16 h1:4ChfhveiNLk4NveAZ9Pu2AN8QZ2nkUGFuadM9lrr5D0= github.com/tetafro/godot v1.4.16/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= -github.com/tetratelabs/wazero v1.6.0 h1:z0H1iikCdP8t+q341xqepY4EWvHEw8Es7tlqiVzlP3g= -github.com/tetratelabs/wazero v1.6.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= +github.com/tetratelabs/wazero v1.7.0 h1:jg5qPydno59wqjpGrHph81lbtHzTrWzwwtD4cD88+hQ= +github.com/tetratelabs/wazero v1.7.0/go.mod h1:ytl6Zuh20R/eROuyDaGPkp82O9C/DJfXAwJfQ3X6/7Y= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= @@ -1124,8 +1118,8 @@ github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/gopher-lua v1.1.0 h1:BojcDhfyDWgU2f2TOzYK/g5p2gxMrku8oupLDqlnSqE= github.com/yuin/gopher-lua v1.1.0/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= -github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= -github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= gitlab.com/bosi/decorder v0.4.1 h1:VdsdfxhstabyhZovHafFw+9eJ6eU0d2CkFNJcZz/NU4= gitlab.com/bosi/decorder v0.4.1/go.mod h1:jecSqWUew6Yle1pCr2eLWTensJMmsxHsBwt+PVbkAqA= @@ -1140,16 +1134,16 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -1159,8 +1153,8 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -1176,7 +1170,6 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1189,8 +1182,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= +golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 h1:UhRVJ0i7bF9n/Hd8YjW3eKjlPVBHzbQdxrBgjbSKl64= @@ -1271,7 +1264,6 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1354,7 +1346,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1365,9 +1356,7 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1377,8 +1366,6 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1390,7 +1377,6 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1529,8 +1515,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1543,8 +1529,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1557,8 +1543,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1567,8 +1553,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-jose/go-jose.v2 v2.6.2 h1:Rl5+9rA0kG3vsO1qhncMPRT5eHICihAMQYJkD7u/i4M= -gopkg.in/go-jose/go-jose.v2 v2.6.2/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= +gopkg.in/go-jose/go-jose.v2 v2.6.3 h1:nt80fvSDlhKWQgSWyHyy5CfmlQr+asih51R8PTWNKKs= +gopkg.in/go-jose/go-jose.v2 v2.6.3/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1598,8 +1584,8 @@ honnef.co/go/tools v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8= honnef.co/go/tools v0.4.6/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= -lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= -lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= +lukechampine.com/blake3 v1.2.2 h1:wEAbSg0IVU4ih44CVlpMqMZMpzr5hf/6aqodLlevd/w= +lukechampine.com/blake3 v1.2.2/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo= lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= modernc.org/cc/v3 v3.41.0 h1:QoR1Sn3YWlmA1T4vLaKZfawdVtSiGx8H+cEojbC7v1Q= diff --git a/internal/core/services/proof.go b/internal/core/services/proof.go index 4e90d1220..acb8eb366 100644 --- a/internal/core/services/proof.go +++ b/internal/core/services/proof.go @@ -334,12 +334,7 @@ func (p *Proof) checkRevocationStatus(ctx context.Context, claim *domain.Claim) } return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: bjp.IssuerData.State.Value, RootOfRoots: bjp.IssuerData.State.RootOfRoots, ClaimsTreeRoot: bjp.IssuerData.State.ClaimsTreeRoot, @@ -514,12 +509,7 @@ func (p *Proof) callNonRevProof(ctx context.Context, issuerData verifiable.Issue NodeAux: nil, }, TreeState: domain.RevocationStatusToTreeState(verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: issuerData.State.Value, RootOfRoots: issuerData.State.RootOfRoots, ClaimsTreeRoot: issuerData.State.ClaimsTreeRoot, diff --git a/internal/core/services/revocation.go b/internal/core/services/revocation.go index fe057df5b..bc00df904 100644 --- a/internal/core/services/revocation.go +++ b/internal/core/services/revocation.go @@ -151,12 +151,7 @@ func getNonRevocationProofFromRHS(ctx context.Context, rhsURL string, data, issu } return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: &s, ClaimsTreeRoot: &CTR, RevocationTreeRoot: &RTR, @@ -240,12 +235,7 @@ func getRevocationStatusFromIssuerData(did *w3c.DID, issuerData *verifiable.Issu } return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: issuerData.State.Value, RootOfRoots: issuerData.State.RootOfRoots, ClaimsTreeRoot: issuerData.State.ClaimsTreeRoot, @@ -351,12 +341,7 @@ func (r *Revocation) getRevocationStatusFromOnchainCredStatusResolver(ctx contex rorHex := ror.Hex() return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: &stateHex, ClaimsTreeRoot: &ctrHex, RevocationTreeRoot: &rtrHex, diff --git a/k8s/helm/values.yaml b/k8s/helm/values.yaml index 3a77404f8..993e7efd5 100644 --- a/k8s/helm/values.yaml +++ b/k8s/helm/values.yaml @@ -54,7 +54,7 @@ apiIssuerNode: issuerEthereumContractAddressAmoy: "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124" issuerEthereumContractAddressMain: "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D" issuerEthereumDefaultGasLimit: "600000" - issuerEthereumMaxGasPrice: "1000000" + issuerEthereumMaxGasPrice: "2500000" issuerEthereumMinGasPrice: "0" issuerEthereumReceiptTimeout: 600s issuerEthereumResolverPrefixMumbai: polygon:mumbai From a65ef21dbade98f9e5c65d15fb7c8b37bd53276b Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Thu, 11 Apr 2024 10:32:47 -0300 Subject: [PATCH 102/110] chore: improve code --- internal/core/services/identity.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index 448aa4778..ecbccad37 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -408,15 +408,15 @@ func (i *identity) processClaims(ctx context.Context, tx pgx.Tx, did w3c.DID, iT claimsAddedToTree = true } - if claimsAddedToTree { - for i := range lc { - err = iTrees.AddClaim(ctx, &lc[i]) - if err != nil { - log.Error(ctx, "adding claim to tree", "err", err) - return false, err - } + for i := range lc { + err = iTrees.AddClaim(ctx, &lc[i]) + if err != nil { + log.Error(ctx, "adding claim to tree", "err", err) + return false, err } + } + return claimsAddedToTree, nil } From b48a30df8c84a1dac5897c1649696d7e97b4d83c Mon Sep 17 00:00:00 2001 From: vbasiuk Date: Fri, 12 Apr 2024 12:34:19 +0300 Subject: [PATCH 103/110] add custom positive-integer/non-negative-integer formats --- .../credentials/IssueCredentialForm.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ui/src/components/credentials/IssueCredentialForm.tsx b/ui/src/components/credentials/IssueCredentialForm.tsx index 2ee6ea684..e0636693b 100644 --- a/ui/src/components/credentials/IssueCredentialForm.tsx +++ b/ui/src/components/credentials/IssueCredentialForm.tsx @@ -109,6 +109,22 @@ export function IssueCredentialForm({ const [refreshServiceChecked, setRefreshServiceChecked] = useState(false); + const isPositiveBigInt = (x: string) => { + try { + return BigInt(x).toString() === x && BigInt(x) > 0; + } catch { + return false; + } + }; + + const isNonNegativeBigInt = (x: string) => { + try { + return BigInt(x).toString() === x && BigInt(x) >= 0; + } catch { + return false; + } + }; + function isFormValid(value: Record, objectAttribute: ObjectAttribute): boolean { if (isAsyncTaskDataAvailable(jsonSchema)) { const serializedSchemaForm = serializeSchemaForm({ @@ -126,6 +142,14 @@ export function IssueCredentialForm({ ? new Ajv2020({ allErrors: true }) : new Ajv({ allErrors: true }); addFormats(ajv); + ajv.addFormat("positive-integer", { + type: "string", + validate: isPositiveBigInt, + }); + ajv.addFormat("non-negative-integer", { + type: "string", + validate: isNonNegativeBigInt, + }); ajv.addVocabulary(["$metadata"]); applyDraft2019Formats(ajv); From 9ffae9311b9288b3c056ccedd53cf930d6173811 Mon Sep 17 00:00:00 2001 From: Javi Date: Fri, 12 Apr 2024 16:08:20 +0200 Subject: [PATCH 104/110] fix: avoid sending null scope (#632) --- internal/api_ui/server_test.go | 6 +++--- internal/core/services/identity.go | 1 + internal/core/services/link.go | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index be5b719f4..8b25da1e6 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -260,7 +260,7 @@ func TestServer_AuthQRCode(t *testing.T) { Body: protocol.AuthorizationRequestMessageBody{ CallbackURL: "https://testing.env/v1/authentication/callback?sessionID=", Reason: "authentication", - Scope: nil, + Scope: make([]protocol.ZeroKnowledgeProofRequest, 0), }, From: issuerDID.String(), Typ: "application/iden3comm-plain-json", @@ -278,7 +278,7 @@ func TestServer_AuthQRCode(t *testing.T) { Body: protocol.AuthorizationRequestMessageBody{ CallbackURL: "https://testing.env/v1/authentication/callback?sessionID=", Reason: "authentication", - Scope: nil, + Scope: make([]protocol.ZeroKnowledgeProofRequest, 0), }, From: issuerDID.String(), Typ: "application/iden3comm-plain-json", @@ -296,7 +296,7 @@ func TestServer_AuthQRCode(t *testing.T) { Body: protocol.AuthorizationRequestMessageBody{ CallbackURL: "https://testing.env/v1/authentication/callback?sessionID=", Reason: "authentication", - Scope: nil, + Scope: make([]protocol.ZeroKnowledgeProofRequest, 0), }, From: issuerDID.String(), Typ: "application/iden3comm-plain-json", diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index ecbccad37..a66306a1f 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -507,6 +507,7 @@ func (i *identity) CreateAuthenticationQRCode(ctx context.Context, serverURL str Body: protocol.AuthorizationRequestMessageBody{ CallbackURL: fmt.Sprintf("%s/v1/authentication/callback?sessionID=%s", serverURL, sessionID), Reason: authReason, + Scope: make([]protocol.ZeroKnowledgeProofRequest, 0), }, } if err := i.sessionManager.Set(ctx, sessionID.String(), *qrCode); err != nil { diff --git a/internal/core/services/link.go b/internal/core/services/link.go index 479c6ee21..76aaac6aa 100644 --- a/internal/core/services/link.go +++ b/internal/core/services/link.go @@ -182,6 +182,7 @@ func (ls *Link) CreateQRCode(ctx context.Context, issuerDID w3c.DID, linkID uuid Body: protocol.AuthorizationRequestMessageBody{ CallbackURL: fmt.Sprintf("%s/v1/credentials/links/callback?sessionID=%s&linkID=%s", serverURL, sessionID, linkID.String()), Reason: authReason, + Scope: make([]protocol.ZeroKnowledgeProofRequest, 0), }, } From c3d36f08ee896c4406adca1fef8c3768cddc99d3 Mon Sep 17 00:00:00 2001 From: daveroga Date: Tue, 16 Apr 2024 22:26:59 +0200 Subject: [PATCH 105/110] add config gasless network --- .env-issuer.sample | 1 + cmd/issuer_initializer/main.go | 1 + cmd/notifications/main.go | 1 + cmd/pending_publisher/main.go | 1 + internal/config/config.go | 2 + internal/core/services/account.go | 1 + internal/providers/blockchain/eth.go | 2 + .../templates/issuer-node-api-configmap.yaml | 1 + k8s/helm/values.yaml | 1 + pkg/blockchain/eth/client.go | 131 ++++++++++-------- 10 files changed, 85 insertions(+), 57 deletions(-) diff --git a/.env-issuer.sample b/.env-issuer.sample index a1445d2d8..d2b3b9a90 100644 --- a/.env-issuer.sample +++ b/.env-issuer.sample @@ -24,6 +24,7 @@ ISSUER_ETHEREUM_CONFIRMATION_BLOCK_COUNT=5 ISSUER_ETHEREUM_RECEIPT_TIMEOUT=600s ISSUER_ETHEREUM_MIN_GAS_PRICE=0 ISSUER_ETHEREUM_MAX_GAS_PRICE=2500000 +ISSUER_ETHEREUM_GASLESS=false ISSUER_ETHEREUM_RPC_RESPONSE_TIMEOUT=5s ISSUER_ETHEREUM_WAIT_RECEIPT_CYCLE_TIME=30s ISSUER_ETHEREUM_WAIT_BLOCK_CYCLE_TIME=30s diff --git a/cmd/issuer_initializer/main.go b/cmd/issuer_initializer/main.go index e42e672b5..30854e465 100644 --- a/cmd/issuer_initializer/main.go +++ b/cmd/issuer_initializer/main.go @@ -137,6 +137,7 @@ func main() { ReceiptTimeout: cfg.Ethereum.ReceiptTimeout, MinGasPrice: big.NewInt(int64(cfg.Ethereum.MinGasPrice)), MaxGasPrice: big.NewInt(int64(cfg.Ethereum.MaxGasPrice)), + GasLess: cfg.Ethereum.GasLess, RPCResponseTimeout: cfg.Ethereum.RPCResponseTimeout, WaitReceiptCycleTime: cfg.Ethereum.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.Ethereum.WaitBlockCycleTime, diff --git a/cmd/notifications/main.go b/cmd/notifications/main.go index 8ba35b4d6..b235ba5a7 100644 --- a/cmd/notifications/main.go +++ b/cmd/notifications/main.go @@ -165,6 +165,7 @@ func newCredentialsService(ctx context.Context, cfg *config.Configuration, stora ReceiptTimeout: cfg.Ethereum.ReceiptTimeout, MinGasPrice: big.NewInt(int64(cfg.Ethereum.MinGasPrice)), MaxGasPrice: big.NewInt(int64(cfg.Ethereum.MaxGasPrice)), + GasLess: cfg.Ethereum.GasLess, RPCResponseTimeout: cfg.Ethereum.RPCResponseTimeout, WaitReceiptCycleTime: cfg.Ethereum.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.Ethereum.WaitBlockCycleTime, diff --git a/cmd/pending_publisher/main.go b/cmd/pending_publisher/main.go index 94f8e894f..844c9c81d 100644 --- a/cmd/pending_publisher/main.go +++ b/cmd/pending_publisher/main.go @@ -151,6 +151,7 @@ func main() { ReceiptTimeout: cfg.Ethereum.ReceiptTimeout, MinGasPrice: big.NewInt(int64(cfg.Ethereum.MinGasPrice)), MaxGasPrice: big.NewInt(int64(cfg.Ethereum.MaxGasPrice)), + GasLess: cfg.Ethereum.GasLess, RPCResponseTimeout: cfg.Ethereum.RPCResponseTimeout, WaitReceiptCycleTime: cfg.Ethereum.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.Ethereum.WaitBlockCycleTime, diff --git a/internal/config/config.go b/internal/config/config.go index 938ef8677..e6efb60c8 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -85,6 +85,7 @@ type Ethereum struct { ReceiptTimeout time.Duration `tip:"Receipt timeout"` MinGasPrice int `tip:"Minimum Gas Price"` MaxGasPrice int `tip:"The Datasource name locator"` + GasLess bool `tip:"Gasless transactions"` RPCResponseTimeout time.Duration `tip:"RPC Response timeout"` WaitReceiptCycleTime time.Duration `tip:"Wait Receipt Cycle Time"` WaitBlockCycleTime time.Duration `tip:"Wait Block Cycle Time"` @@ -464,6 +465,7 @@ func bindEnv() { _ = viper.BindEnv("Ethereum.ReceiptTimeout", "ISSUER_ETHEREUM_RECEIPT_TIMEOUT") _ = viper.BindEnv("Ethereum.MinGasPrice", "ISSUER_ETHEREUM_MIN_GAS_PRICE") _ = viper.BindEnv("Ethereum.MaxGasPrice", "ISSUER_ETHEREUM_MAX_GAS_PRICE") + _ = viper.BindEnv("Ethereum.GasLess", "ISSUER_ETHEREUM_GASLESS") _ = viper.BindEnv("Ethereum.RPCResponseTimeout", "ISSUER_ETHEREUM_RPC_RESPONSE_TIMEOUT") _ = viper.BindEnv("Ethereum.WaitReceiptCycleTime", "ISSUER_ETHEREUM_WAIT_RECEIPT_CYCLE_TIME") _ = viper.BindEnv("Ethereum.WaitBlockCycleTime", "ISSUER_ETHEREUM_WAIT_BLOCK_CYCLE_TIME") diff --git a/internal/core/services/account.go b/internal/core/services/account.go index 082c6b353..3ae931d41 100644 --- a/internal/core/services/account.go +++ b/internal/core/services/account.go @@ -35,6 +35,7 @@ func NewAccountService(ethConfig config.Ethereum, keyStore *kms.KMS) *AccountSer ReceiptTimeout: ethConfig.ReceiptTimeout, MinGasPrice: big.NewInt(int64(ethConfig.MinGasPrice)), MaxGasPrice: big.NewInt(int64(ethConfig.MaxGasPrice)), + GasLess: ethConfig.GasLess, RPCResponseTimeout: ethConfig.RPCResponseTimeout, WaitReceiptCycleTime: ethConfig.WaitReceiptCycleTime, WaitBlockCycleTime: ethConfig.WaitBlockCycleTime, diff --git a/internal/providers/blockchain/eth.go b/internal/providers/blockchain/eth.go index 1d0314041..829602b05 100644 --- a/internal/providers/blockchain/eth.go +++ b/internal/providers/blockchain/eth.go @@ -41,6 +41,7 @@ func InitEthConnect(cfg config.Ethereum, kms *kms.KMS) (*eth.Client, error) { ReceiptTimeout: cfg.ReceiptTimeout, MinGasPrice: big.NewInt(int64(cfg.MinGasPrice)), MaxGasPrice: big.NewInt(int64(cfg.MaxGasPrice)), + GasLess: cfg.GasLess, RPCResponseTimeout: cfg.RPCResponseTimeout, WaitReceiptCycleTime: cfg.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.WaitBlockCycleTime, @@ -65,6 +66,7 @@ func Open(cfg *config.Configuration, kms *kms.KMS) (*eth.Client, error) { ReceiptTimeout: cfg.Ethereum.ReceiptTimeout, MinGasPrice: big.NewInt(int64(cfg.Ethereum.MinGasPrice)), MaxGasPrice: big.NewInt(int64(cfg.Ethereum.MaxGasPrice)), + GasLess: cfg.Ethereum.GasLess, RPCResponseTimeout: cfg.Ethereum.RPCResponseTimeout, WaitReceiptCycleTime: cfg.Ethereum.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.Ethereum.WaitBlockCycleTime, diff --git a/k8s/helm/templates/issuer-node-api-configmap.yaml b/k8s/helm/templates/issuer-node-api-configmap.yaml index b9e51d244..1d3abf7bb 100644 --- a/k8s/helm/templates/issuer-node-api-configmap.yaml +++ b/k8s/helm/templates/issuer-node-api-configmap.yaml @@ -26,6 +26,7 @@ data: ISSUER_ETHEREUM_CONFIRMATION_BLOCK_COUNT: {{ .Values.apiIssuerNode.configMap.issuerEthereumConfirmationBlockCount | quote }} ISSUER_ETHEREUM_MAX_GAS_PRICE: {{ .Values.apiIssuerNode.configMap.issuerEthereumMaxGasPrice | quote }} ISSUER_ETHEREUM_MIN_GAS_PRICE: {{ .Values.apiIssuerNode.configMap.issuerEthereumMinGasPrice | quote }} + ISSUER_ETHEREUM_GASLESS: {{ .Values.apiIssuerNode.configMap.issuerEthereumGasLess | quote }} ISSUER_ETHEREUM_RPC_RESPONSE_TIMEOUT: {{ .Values.apiIssuerNode.configMap.issuerEthereumRpcResponseTimeout }} ISSUER_ETHEREUM_RECEIPT_TIMEOUT: {{ .Values.apiIssuerNode.configMap.issuerEthereumReceiptTimeout }} ISSUER_ETHEREUM_WAIT_BLOCK_CYCLE_TIME: {{ .Values.apiIssuerNode.configMap.issuerEthereumWaitBlockCycleTime }} diff --git a/k8s/helm/values.yaml b/k8s/helm/values.yaml index 993e7efd5..f02f40fab 100644 --- a/k8s/helm/values.yaml +++ b/k8s/helm/values.yaml @@ -56,6 +56,7 @@ apiIssuerNode: issuerEthereumDefaultGasLimit: "600000" issuerEthereumMaxGasPrice: "2500000" issuerEthereumMinGasPrice: "0" + issuerEthereumGasLess: "false" issuerEthereumReceiptTimeout: 600s issuerEthereumResolverPrefixMumbai: polygon:mumbai issuerEthereumResolverPrefixAmoy: polygon:amoy diff --git a/pkg/blockchain/eth/client.go b/pkg/blockchain/eth/client.go index ef1525724..2d8742f5d 100644 --- a/pkg/blockchain/eth/client.go +++ b/pkg/blockchain/eth/client.go @@ -65,6 +65,7 @@ type ClientConfig struct { DefaultGasLimit int `json:"default_gas_limit"` MinGasPrice *big.Int `json:"min_gas_price"` MaxGasPrice *big.Int `json:"max_gas_price"` + GasLess bool `json:"gas_less"` RPCResponseTimeout time.Duration `json:"rpc_response_time_out"` WaitReceiptCycleTime time.Duration `json:"wait_receipt_cycle_time_out"` WaitBlockCycleTime time.Duration `json:"wait_block_cycle_time_out"` @@ -317,18 +318,25 @@ func (c *Client) CreateTxOpts(ctx context.Context, kmsKey kms.KeyID) (*bind.Tran sigFn := c.signerFnFactory(ctx, kmsKey) - tip, err := c.suggestGasTipCap(ctx) - if err != nil { - return nil, err - } + // tip := big.NewInt(0) + gasLimit := uint64(c.Config.DefaultGasLimit) opts := &bind.TransactOpts{ - From: addr, - Signer: sigFn, - GasTipCap: tip, // The only option we need to set is gasTipCap as some Ethereum nodes don't support eth_maxPriorityFeePerGas - GasLimit: 0, // go-ethereum library will estimate gas limit automatically if it is 0 - Context: ctx, - NoSend: false, + From: addr, + Signer: sigFn, + GasLimit: gasLimit, // go-ethereum library will estimate gas limit automatically if it is 0 + Context: ctx, + NoSend: false, + } + + if !c.Config.GasLess { // Some Ethereum nodes don't support eth_maxPriorityFeePerGas so we set GasLess = true + tip, err := c.suggestGasTipCap(ctx) + if err != nil { + return nil, err + } + gasLimit = uint64(0) + opts.GasLimit = gasLimit + opts.GasTipCap = tip } return opts, nil @@ -357,63 +365,72 @@ func (c *Client) CreateRawTx(ctx context.Context, txParams TransactionParams) (* txParams.Nonce = &nonce } - _ctx2, cancel2 := context.WithTimeout(ctx, c.Config.RPCResponseTimeout) - defer cancel2() if txParams.Value == nil { txParams.Value = big.NewInt(0) } - gasLimit, err := c.client.EstimateGas(_ctx2, ethereum.CallMsg{ - From: txParams.FromAddress, // the sender of the 'transaction' + + baseTx := &types.DynamicFeeTx{ To: &txParams.ToAddress, - Gas: 0, // wei <-> gas exchange ratio - Value: txParams.Value, // amount of wei sent along with the call + Nonce: *txParams.Nonce, + Gas: uint64(c.Config.DefaultGasLimit), + Value: txParams.Value, Data: txParams.Payload, - }) - if err != nil { - return nil, fmt.Errorf("failed to estimate gas: %v", err) } - latestBlockHeader, err := c.HeaderByNumber(ctx, nil) - if err != nil { - return nil, err - } + if !c.Config.GasLess { + _ctx2, cancel2 := context.WithTimeout(ctx, c.Config.RPCResponseTimeout) + defer cancel2() + gasLimit, err := c.client.EstimateGas(_ctx2, ethereum.CallMsg{ + From: txParams.FromAddress, // the sender of the 'transaction' + To: &txParams.ToAddress, + Gas: 0, // wei <-> gas exchange ratio + Value: txParams.Value, // amount of wei sent along with the call + Data: txParams.Payload, + }) + + baseTx.Gas = gasLimit - if txParams.BaseFee == nil { - // since ETH and Polygon blockchain already supports London fork. - // no need set special block. - baseFee := eip1559.CalcBaseFee(¶ms.ChainConfig{LondonBlock: big.NewInt(1)}, latestBlockHeader) - - // add 25% to baseFee. baseFee always small value. - // since we use dynamic fee transactions we will get not used gas back. - b := math.Round(float64(baseFee.Int64()) * feeIncrement) - baseFee = big.NewInt(int64(b)) - txParams.BaseFee = baseFee - } - - if txParams.GasTips == nil { - _ctx3, cancel3 := context.WithTimeout(ctx, c.Config.RPCResponseTimeout) - defer cancel3() - gasTip, err := c.client.SuggestGasTipCap(_ctx3) - // since hardhad doesn't support 'eth_maxPriorityFeePerGas' rpc call. - // we should hardcode 0 as a mainer tips. More information: https://github.com/NomicFoundation/hardhat/issues/1664#issuecomment-1149006010 - if err != nil && strings.Contains(err.Error(), "eth_maxPriorityFeePerGas not found") { - log.Error(ctx, "failed get suggest gas tip: %s. use 0 instead", "err", err) - gasTip = big.NewInt(0) - } else if err != nil { - return nil, fmt.Errorf("failed get suggest gas tip: %v", err) + if err != nil { + return nil, fmt.Errorf("failed to estimate gas: %v", err) } - txParams.GasTips = gasTip - } - maxGasPricePerFee := big.NewInt(0).Add(txParams.BaseFee, txParams.GasTips) - baseTx := &types.DynamicFeeTx{ - To: &txParams.ToAddress, - Nonce: *txParams.Nonce, - Gas: gasLimit, - Value: txParams.Value, - Data: txParams.Payload, - GasTipCap: txParams.GasTips, - GasFeeCap: maxGasPricePerFee, + latestBlockHeader, err := c.HeaderByNumber(ctx, nil) + if err != nil { + return nil, err + } + + if txParams.BaseFee == nil { + // since ETH and Polygon blockchain already supports London fork. + // no need set special block. + baseFee := eip1559.CalcBaseFee(¶ms.ChainConfig{LondonBlock: big.NewInt(1)}, latestBlockHeader) + + // add 25% to baseFee. baseFee always small value. + // since we use dynamic fee transactions we will get not used gas back. + b := math.Round(float64(baseFee.Int64()) * feeIncrement) + baseFee = big.NewInt(int64(b)) + txParams.BaseFee = baseFee + } + + if txParams.GasTips == nil { + _ctx3, cancel3 := context.WithTimeout(ctx, c.Config.RPCResponseTimeout) + defer cancel3() + gasTip, err := c.client.SuggestGasTipCap(_ctx3) + // since hardhad doesn't support 'eth_maxPriorityFeePerGas' rpc call. + // we should hardcode 0 as a mainer tips. More information: https://github.com/NomicFoundation/hardhat/issues/1664#issuecomment-1149006010 + if err != nil && strings.Contains(err.Error(), "eth_maxPriorityFeePerGas not found") { + log.Error(ctx, "failed get suggest gas tip: %s. use 0 instead", "err", err) + gasTip = big.NewInt(0) + } else if err != nil { + return nil, fmt.Errorf("failed get suggest gas tip: %v", err) + } + txParams.GasTips = gasTip + } + + maxGasPricePerFee := big.NewInt(0).Add(txParams.BaseFee, txParams.GasTips) + + baseTx.GasTipCap = txParams.GasTips + baseTx.GasFeeCap = maxGasPricePerFee + } tx := types.NewTx(baseTx) From a3887fdf445beaad4bbd49fb9b383916574ecab2 Mon Sep 17 00:00:00 2001 From: daveroga Date: Wed, 17 Apr 2024 10:25:49 +0200 Subject: [PATCH 106/110] remove unnecessary tab --- k8s/helm/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/helm/values.yaml b/k8s/helm/values.yaml index f02f40fab..f4f134c6d 100644 --- a/k8s/helm/values.yaml +++ b/k8s/helm/values.yaml @@ -56,7 +56,7 @@ apiIssuerNode: issuerEthereumDefaultGasLimit: "600000" issuerEthereumMaxGasPrice: "2500000" issuerEthereumMinGasPrice: "0" - issuerEthereumGasLess: "false" + issuerEthereumGasLess: "false" issuerEthereumReceiptTimeout: 600s issuerEthereumResolverPrefixMumbai: polygon:mumbai issuerEthereumResolverPrefixAmoy: polygon:amoy From f876fdcbc52edcc0fcb364678ac2813789c6ab4f Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Mon, 20 May 2024 08:58:15 -0300 Subject: [PATCH 107/110] fix: revocation status url --- cmd/issuer_initializer/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/issuer_initializer/main.go b/cmd/issuer_initializer/main.go index e42e672b5..dcbec6501 100644 --- a/cmd/issuer_initializer/main.go +++ b/cmd/issuer_initializer/main.go @@ -142,11 +142,11 @@ func main() { WaitBlockCycleTime: cfg.Ethereum.WaitBlockCycleTime, }, keyStore) + // this is needed to create the did with the correct auth core claim revocation status URL + cfg.CredentialStatus.DirectStatus.URL = cfg.APIUI.ServerURL rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.GetURL(), ethConn, common.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut) revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus) cfg.CredentialStatus.SingleIssuer = true - // this is needed to create the did with the correct auth core claim revocation status URL - cfg.CredentialStatus.DirectStatus.URL = cfg.APIUI.ServerURL identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, nil, claimsRepository, nil, nil, storage, nil, nil, nil, cfg.CredentialStatus, rhsFactory, revocationStatusResolver) didCreationOptions := &ports.DIDCreationOptions{ From 8d7b8e3510da5b071fb3eb98497f68c180189d3f Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Wed, 22 May 2024 09:53:46 -0300 Subject: [PATCH 108/110] chore: update libraries to support amoy network --- go.mod | 16 ++++++------ go.sum | 39 ++++++++++++---------------- internal/api/server.go | 1 + internal/core/services/proof.go | 14 ++-------- internal/core/services/revocation.go | 21 +++------------ 5 files changed, 30 insertions(+), 61 deletions(-) diff --git a/go.mod b/go.mod index 18a60a092..ff3dcffeb 100644 --- a/go.mod +++ b/go.mod @@ -12,17 +12,17 @@ require ( github.com/go-redis/cache/v8 v8.4.4 github.com/go-redis/redis/v8 v8.11.5 github.com/golangci/golangci-lint v1.55.2 - github.com/google/uuid v1.4.0 + github.com/google/uuid v1.6.0 github.com/hashicorp/go-retryablehttp v0.7.5 github.com/hashicorp/vault/api v1.10.0 github.com/hashicorp/vault/api/auth/userpass v0.5.0 github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0 github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f - github.com/iden3/go-circuits/v2 v2.0.0 - github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 - github.com/iden3/go-iden3-core/v2 v2.0.0 - github.com/iden3/go-iden3-crypto v0.0.15 - github.com/iden3/go-jwz/v2 v2.0.0 + github.com/iden3/go-circuits/v2 v2.2.0 + github.com/iden3/go-iden3-auth/v2 v2.2.2 + github.com/iden3/go-iden3-core/v2 v2.1.0 + github.com/iden3/go-iden3-crypto v0.0.16 + github.com/iden3/go-jwz/v2 v2.0.2 github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 github.com/iden3/go-merkletree-sql/v2 v2.0.6 github.com/iden3/go-rapidsnark/prover v0.0.10 @@ -30,8 +30,8 @@ require ( github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 - github.com/iden3/go-schema-processor/v2 v2.1.0 - github.com/iden3/iden3comm/v2 v2.0.0 + github.com/iden3/go-schema-processor/v2 v2.3.3 + github.com/iden3/iden3comm/v2 v2.3.2 github.com/iden3/merkletree-proof v0.0.4 github.com/ipfs/go-ipfs-api v0.7.0 github.com/jackc/pgconn v1.14.1 diff --git a/go.sum b/go.sum index 344640227..b7a7ac86a 100644 --- a/go.sum +++ b/go.sum @@ -310,7 +310,6 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -405,8 +404,8 @@ github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f h1:pDhu5sgp8yJlEF/g6o github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= @@ -480,18 +479,18 @@ github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48/go.mod h1:kJmVPMk4HfWyl2kcta34aad/K4TAfCwB29xX9PsR7LQ= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f h1:aTYEBIh802oWF6B3jhXf5F7UVGxfPJG70shYkRXzb+s= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20231006071010-f511d08ca36f/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= -github.com/iden3/go-circuits/v2 v2.0.0 h1:Bw0mpsqeip06d6I2ktgfhTVB7Jk9mSHi8myHZWkoc6w= -github.com/iden3/go-circuits/v2 v2.0.0/go.mod h1:VIFIp51+IH0hOzjnKhb84bCeyq7hq76zX/C14ua6zh4= -github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2 h1:r5vjH+MyPFzaJ7U62SO5Gz9N9O0RZfDORNHVd9JymNg= -github.com/iden3/go-iden3-auth/v2 v2.0.0-beta.2/go.mod h1:bYr47aev7sh23RL7Ru+TQQSlYDS94+wO8P8SDrwdifc= +github.com/iden3/go-circuits/v2 v2.2.0 h1:qJeySVPG9vxZwJyL/CsvXdUhccWOctXQUYGnyX5p2Kc= +github.com/iden3/go-circuits/v2 v2.2.0/go.mod h1:1LET+T8i9Rkfx+RNj2BBHKAPGDODEWWwSEFjR6g3h6c= +github.com/iden3/go-iden3-auth/v2 v2.2.2 h1:4uA+m5H2OvhfOsMJaeXaCjciV2sHypvHgGHewZfXB58= +github.com/iden3/go-iden3-auth/v2 v2.2.2/go.mod h1:1ytFvnSnuNK2m9BoVrgYJoLNH919Bg2pt68pFelcJcM= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= -github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA= -github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= -github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= -github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= -github.com/iden3/go-jwz/v2 v2.0.0 h1:VsU2PrmcchPMx/V0IhamMZRNjiQYZoyJopO8K8uSZOY= -github.com/iden3/go-jwz/v2 v2.0.0/go.mod h1:JBJ58Cef8h+4Uz8qaVRsNjiT/Ubqb800dGKTZt66NkU= +github.com/iden3/go-iden3-core/v2 v2.1.0 h1:R1s7Tj3tIx5lDy8S7OJrSNuxXIFeRzWRmTBaQoQHJps= +github.com/iden3/go-iden3-core/v2 v2.1.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= +github.com/iden3/go-iden3-crypto v0.0.16 h1:zN867xiz6HgErXVIV/6WyteGcOukE9gybYTorBMEdsk= +github.com/iden3/go-iden3-crypto v0.0.16/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= +github.com/iden3/go-jwz/v2 v2.0.2 h1:yx56x1TZcObeuj6cvX715Jd7QTxnCpHwbETKWCPJmhw= +github.com/iden3/go-jwz/v2 v2.0.2/go.mod h1:B1r6wJpPhIiuZTmgicNoogr7XD/VS3jZu9U519GwWz4= github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 h1:CKry110riXxBu1bM9vhdPia37tlbqoKYg0s0dwGA4l4= github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5/go.mod h1:J17cXiT4pBP/c5FWN4nv0J7q2yT9I8JSzUfdIKyZIj4= github.com/iden3/go-merkletree-sql/v2 v2.0.6 h1:vsVDImnvnHf7Ggr45ptFOXJyWNA/8IwVQO1jzRLUlY8= @@ -508,10 +507,10 @@ github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e/go.mod h1:UEBifEzw62T6VzIHJeHuUgeLg2U/J9ttf7hOwQEqnYk= github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFLPTEqnOIvlM= github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= -github.com/iden3/go-schema-processor/v2 v2.1.0 h1:8/fA7IVkyVmpbJij9Ar0X2zWPQJMlCaaPP4hfTZqbqU= -github.com/iden3/go-schema-processor/v2 v2.1.0/go.mod h1:EogHwnFnxQKOGRVme6upCcisoAQeEIl+HuRAGa7w3+w= -github.com/iden3/iden3comm/v2 v2.0.0 h1:cFDfF6aJ589ENg5zlTBEPK6Qqv4I11C/gliAWZORpyY= -github.com/iden3/iden3comm/v2 v2.0.0/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= +github.com/iden3/go-schema-processor/v2 v2.3.3 h1:GfChxMZHG4miA3p/5rLIrM7TGmKu/oAAXgLloYTBHSI= +github.com/iden3/go-schema-processor/v2 v2.3.3/go.mod h1:8y/R0iQpYhyhRQ3sL4F5Aja3+1T68M6uwGQdC4pQ4X0= +github.com/iden3/iden3comm/v2 v2.3.2 h1:ulD0oI/+qsEmnHVELWrxdLNvQOOWr/JLVMFXzEVbr5E= +github.com/iden3/iden3comm/v2 v2.3.2/go.mod h1:HVdSjre4og+kdJ5Cqe2b3Dt2ccOogOdfyWwKaUSAelw= github.com/iden3/merkletree-proof v0.0.4 h1:o1XXws6zb7+BBDQYXlo0GPUH+jUY3+GxkT88U1C4Sb8= github.com/iden3/merkletree-proof v0.0.4/go.mod h1:D49CVDG/tshMiZuDCxWjGJoNplRg9y9XIlg9/eMSYOc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -740,8 +739,6 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= -github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk= github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= @@ -1069,8 +1066,6 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1280,8 +1275,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= diff --git a/internal/api/server.go b/internal/api/server.go index 6db1aedd7..03509d5ab 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -392,6 +392,7 @@ func (s *Server) Agent(ctx context.Context, request AgentRequestObject) (AgentRe log.Debug(ctx, "agent empty request") return Agent400JSONResponse{N400JSONResponse{"cannot proceed with an empty request"}}, nil } + fmt.Println(request.Body) basicMessage, err := s.packageManager.UnpackWithType(packers.MediaTypeZKPMessage, []byte(*request.Body)) if err != nil { log.Debug(ctx, "agent bad request", "err", err, "body", *request.Body) diff --git a/internal/core/services/proof.go b/internal/core/services/proof.go index 4e90d1220..acb8eb366 100644 --- a/internal/core/services/proof.go +++ b/internal/core/services/proof.go @@ -334,12 +334,7 @@ func (p *Proof) checkRevocationStatus(ctx context.Context, claim *domain.Claim) } return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: bjp.IssuerData.State.Value, RootOfRoots: bjp.IssuerData.State.RootOfRoots, ClaimsTreeRoot: bjp.IssuerData.State.ClaimsTreeRoot, @@ -514,12 +509,7 @@ func (p *Proof) callNonRevProof(ctx context.Context, issuerData verifiable.Issue NodeAux: nil, }, TreeState: domain.RevocationStatusToTreeState(verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: issuerData.State.Value, RootOfRoots: issuerData.State.RootOfRoots, ClaimsTreeRoot: issuerData.State.ClaimsTreeRoot, diff --git a/internal/core/services/revocation.go b/internal/core/services/revocation.go index e861b67d9..3740537fb 100644 --- a/internal/core/services/revocation.go +++ b/internal/core/services/revocation.go @@ -227,12 +227,7 @@ func getNonRevocationProofFromRHS(ctx context.Context, rhsURL string, data, issu } return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: &s, ClaimsTreeRoot: &CTR, RevocationTreeRoot: &RTR, @@ -316,12 +311,7 @@ func getRevocationStatusFromIssuerData(did *w3c.DID, issuerData *verifiable.Issu } return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: issuerData.State.Value, RootOfRoots: issuerData.State.RootOfRoots, ClaimsTreeRoot: issuerData.State.ClaimsTreeRoot, @@ -427,12 +417,7 @@ func (r *Revocation) getRevocationStatusFromOnchainCredStatusResolver(ctx contex rorHex := ror.Hex() return &verifiable.RevocationStatus{ - Issuer: struct { - State *string `json:"state,omitempty"` - RootOfRoots *string `json:"rootOfRoots,omitempty"` - ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` - RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` - }{ + Issuer: verifiable.TreeState{ State: &stateHex, ClaimsTreeRoot: &ctrHex, RevocationTreeRoot: &rtrHex, From 4b3737d90183b66bbb2ae0597f7d02259b43ad68 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Wed, 22 May 2024 11:00:47 -0300 Subject: [PATCH 109/110] chore: remove print --- internal/api/server.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/api/server.go b/internal/api/server.go index e11b72374..68dac11a0 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -407,7 +407,6 @@ func (s *Server) Agent(ctx context.Context, request AgentRequestObject) (AgentRe log.Debug(ctx, "agent empty request") return Agent400JSONResponse{N400JSONResponse{"cannot proceed with an empty request"}}, nil } - fmt.Println(request.Body) basicMessage, err := s.packageManager.UnpackWithType(packers.MediaTypeZKPMessage, []byte(*request.Body)) if err != nil { log.Debug(ctx, "agent bad request", "err", err, "body", *request.Body) From 06866af182811815e5524adee93378e16db657bc Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Tue, 28 May 2024 14:01:00 -0300 Subject: [PATCH 110/110] chore: clean code and change endpoint to unpack with a different message --- cmd/platform/main.go | 17 +- cmd/platform_ui/main.go | 16 +- internal/api/server.go | 3 +- internal/core/ports/revocation_service.go | 13 - internal/core/services/claims.go | 1 + internal/core/services/proof.go | 737 ---------------------- internal/core/services/revocation.go | 482 -------------- pkg/protocol/packagemanager.go | 39 +- 8 files changed, 8 insertions(+), 1300 deletions(-) delete mode 100644 internal/core/ports/revocation_service.go delete mode 100644 internal/core/services/proof.go delete mode 100644 internal/core/services/revocation.go diff --git a/cmd/platform/main.go b/cmd/platform/main.go index f221e75f0..649052168 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -30,7 +30,6 @@ import ( "github.com/polygonid/sh-id-platform/internal/providers/blockchain" "github.com/polygonid/sh-id-platform/internal/redis" "github.com/polygonid/sh-id-platform/internal/repositories" - "github.com/polygonid/sh-id-platform/pkg/blockchain/eth" "github.com/polygonid/sh-id-platform/pkg/cache" "github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status" circuitLoaders "github.com/polygonid/sh-id-platform/pkg/loaders" @@ -147,20 +146,6 @@ func main() { claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.ServerUrl, ps, cfg.IPFS.GatewayURL, revocationStatusResolver) proofService := gateways.NewProver(ctx, cfg, circuitsLoaderService) - stateService, err := eth.NewStateService(eth.StateServiceConfig{ - EthClient: ethConn, - StateAddress: common.HexToAddress(cfg.Ethereum.ContractAddress), - ResponseTimeout: cfg.Ethereum.RPCResponseTimeout, - }) - if err != nil { - log.Error(ctx, "failed init state service", "err", err) - return - } - - onChainCredentialStatusResolverService := gateways.NewOnChainCredStatusResolverService(ethConn, cfg.Ethereum.RPCResponseTimeout) - revocationService := services.NewRevocationService(common.HexToAddress(cfg.Ethereum.ContractAddress), stateService, onChainCredentialStatusResolverService) - - zkProofService := services.NewProofService(claimsService, revocationService, identityService, mtService, claimsRepository, keyStore, storage, stateService, schemaLoader) transactionService, err := gateways.NewTransaction(ethereumClient, cfg.Ethereum.ConfirmationBlockCount) if err != nil { log.Error(ctx, "error creating transaction service", "err", err) @@ -175,7 +160,7 @@ func main() { publisher := gateways.NewPublisher(storage, identityService, claimsService, mtService, keyStore, transactionService, proofService, publisherGateway, cfg.Ethereum.ConfirmationTimeout, ps) - packageManager, err := protocol.InitPackageManager(ctx, stateContract, zkProofService, cfg.Circuit.Path) + packageManager, err := protocol.InitPackageManager(stateContract, cfg.Circuit.Path) if err != nil { log.Error(ctx, "failed init package protocol", "err", err) return diff --git a/cmd/platform_ui/main.go b/cmd/platform_ui/main.go index 27d9f5e3c..3c600c2cb 100644 --- a/cmd/platform_ui/main.go +++ b/cmd/platform_ui/main.go @@ -37,7 +37,6 @@ import ( "github.com/polygonid/sh-id-platform/internal/providers/blockchain" "github.com/polygonid/sh-id-platform/internal/redis" "github.com/polygonid/sh-id-platform/internal/repositories" - "github.com/polygonid/sh-id-platform/pkg/blockchain/eth" "github.com/polygonid/sh-id-platform/pkg/cache" "github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status" circuitLoaders "github.com/polygonid/sh-id-platform/pkg/loaders" @@ -181,19 +180,6 @@ func main() { connectionsService := services.NewConnection(connectionsRepository, claimsRepository, storage) linkService := services.NewLinkService(storage, claimsService, qrService, claimsRepository, linkRepository, schemaRepository, schemaLoader, sessionRepository, ps, cfg.IPFS.GatewayURL) - stateService, err := eth.NewStateService(eth.StateServiceConfig{ - EthClient: ethConn, - StateAddress: common.HexToAddress(cfg.Ethereum.ContractAddress), - ResponseTimeout: cfg.Ethereum.RPCResponseTimeout, - }) - if err != nil { - log.Error(ctx, "failed init state service", "err", err) - return - } - - onChainCredentialStatusResolverService := gateways.NewOnChainCredStatusResolverService(ethConn, cfg.Ethereum.RPCResponseTimeout) - revocationService := services.NewRevocationService(common.HexToAddress(cfg.Ethereum.ContractAddress), stateService, onChainCredentialStatusResolverService) - zkProofService := services.NewProofService(claimsService, revocationService, identityService, mtService, claimsRepository, keyStore, storage, stateService, schemaLoader) transactionService, err := gateways.NewTransaction(ethereumClient, cfg.Ethereum.ConfirmationBlockCount) if err != nil { log.Error(ctx, "error creating transaction service", "err", err) @@ -208,7 +194,7 @@ func main() { publisher := gateways.NewPublisher(storage, identityService, claimsService, mtService, keyStore, transactionService, proofService, publisherGateway, cfg.Ethereum.ConfirmationTimeout, ps) - packageManager, err := protocol.InitPackageManager(ctx, stateContract, zkProofService, cfg.Circuit.Path) + packageManager, err := protocol.InitPackageManager(stateContract, cfg.Circuit.Path) if err != nil { log.Error(ctx, "failed init package protocol", "err", err) return diff --git a/internal/api/server.go b/internal/api/server.go index 68dac11a0..a026cb94e 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -407,7 +407,8 @@ func (s *Server) Agent(ctx context.Context, request AgentRequestObject) (AgentRe log.Debug(ctx, "agent empty request") return Agent400JSONResponse{N400JSONResponse{"cannot proceed with an empty request"}}, nil } - basicMessage, err := s.packageManager.UnpackWithType(packers.MediaTypeZKPMessage, []byte(*request.Body)) + + basicMessage, _, err := s.packageManager.Unpack([]byte(*request.Body)) if err != nil { log.Debug(ctx, "agent bad request", "err", err, "body", *request.Body) return Agent400JSONResponse{N400JSONResponse{"cannot proceed with the given request"}}, nil diff --git a/internal/core/ports/revocation_service.go b/internal/core/ports/revocation_service.go deleted file mode 100644 index efd7cc726..000000000 --- a/internal/core/ports/revocation_service.go +++ /dev/null @@ -1,13 +0,0 @@ -package ports - -import ( - "context" - - "github.com/iden3/go-iden3-core/v2/w3c" - "github.com/iden3/go-schema-processor/v2/verifiable" -) - -// RevocationService is the interface implemented by the RevocationService service -type RevocationService interface { - Status(ctx context.Context, credStatus interface{}, issuerDID *w3c.DID, issuerData *verifiable.IssuerData) (*verifiable.RevocationStatus, error) -} diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 1a8192bca..5ed45b479 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -630,6 +630,7 @@ func (c *claim) getRevocationStatus(ctx context.Context, basicMessage *ports.Age Body: protocol.RevocationStatusResponseMessageBody{RevocationStatus: *revStatus}, From: basicMessage.IssuerDID.String(), To: basicMessage.UserDID.String(), + Typ: packers.MediaTypePlainMessage, }, nil } diff --git a/internal/core/services/proof.go b/internal/core/services/proof.go deleted file mode 100644 index acb8eb366..000000000 --- a/internal/core/services/proof.go +++ /dev/null @@ -1,737 +0,0 @@ -package services - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "math/big" - "time" - - "github.com/google/uuid" - "github.com/iden3/go-circuits/v2" - core "github.com/iden3/go-iden3-core/v2" - "github.com/iden3/go-iden3-core/v2/w3c" - "github.com/iden3/go-iden3-crypto/babyjub" - "github.com/iden3/go-merkletree-sql/v2" - jsonSuite "github.com/iden3/go-schema-processor/v2/json" - "github.com/iden3/go-schema-processor/v2/merklize" - "github.com/iden3/go-schema-processor/v2/processor" - "github.com/iden3/go-schema-processor/v2/verifiable" - "github.com/jackc/pgx/v4" - "github.com/piprate/json-gold/ld" - - "github.com/polygonid/sh-id-platform/internal/common" - "github.com/polygonid/sh-id-platform/internal/core/domain" - "github.com/polygonid/sh-id-platform/internal/core/ports" - "github.com/polygonid/sh-id-platform/internal/db" - "github.com/polygonid/sh-id-platform/internal/jsonschema" - "github.com/polygonid/sh-id-platform/internal/kms" - "github.com/polygonid/sh-id-platform/internal/loader" - "github.com/polygonid/sh-id-platform/internal/log" - "github.com/polygonid/sh-id-platform/internal/repositories" - "github.com/polygonid/sh-id-platform/pkg/credentials/signature/circuit/signer" - "github.com/polygonid/sh-id-platform/pkg/protocol" -) - -const ( - defaultAtomicCircuitsID = 10 -) - -// ErrAllClaimsRevoked all claims are revoked. -var ( - ErrAllClaimsRevoked = errors.New("all claims are revoked") -) - -// Proof service generates and validates ZK zk -type Proof struct { - claimSrv ports.ClaimsService - revocationSrv ports.RevocationService - identitySrv ports.IdentityService - mtService ports.MtService - claimsRepository ports.ClaimsRepository - keyProvider *kms.KMS - storage *db.Storage - stateService ports.StateService - schemaLoader loader.DocumentLoader - merklizeOptions []merklize.MerklizeOption -} - -// NewProofService init proof service -func NewProofService(claimSrv ports.ClaimsService, revocationSrv ports.RevocationService, identitySrv ports.IdentityService, mtService ports.MtService, claimsRepository ports.ClaimsRepository, keyProvider *kms.KMS, storage *db.Storage, stateService ports.StateService, ld ld.DocumentLoader) ports.ProofService { - merklizeOptions := []merklize.MerklizeOption{ - merklize.WithDocumentLoader(ld), - } - return &Proof{ - claimSrv: claimSrv, - revocationSrv: revocationSrv, - identitySrv: identitySrv, - mtService: mtService, - claimsRepository: claimsRepository, - keyProvider: keyProvider, - storage: storage, - stateService: stateService, - schemaLoader: ld, - merklizeOptions: merklizeOptions, - } -} - -// PrepareInputs prepare inputs for circuit. -// -//nolint:gocyclo // refactor later to avoid big PR. -func (p *Proof) PrepareInputs(ctx context.Context, identifier *w3c.DID, query ports.Query) ([]byte, []*domain.Claim, error) { - var claims []*domain.Claim - var err error - var claim *domain.Claim - - var circuitInputs circuits.InputsMarshaller - switch circuits.CircuitID(query.CircuitID) { - case circuits.AtomicQuerySigV2CircuitID: - circuitInputs, claim, err = p.prepareAtomicQuerySigV2Circuit(ctx, identifier, query) - if err != nil { - return nil, nil, err - } - claims = append(claims, claim) - - case circuits.AtomicQueryMTPV2CircuitID: - circuitInputs, claim, err = p.prepareAtomicQueryMTPV2Circuit(ctx, identifier, query) - if err != nil { - return nil, nil, err - } - claims = append(claims, claim) - - case circuits.AuthV2CircuitID: - circuitInputs, err = p.prepareAuthV2Circuit(ctx, identifier, query.Challenge) - if err != nil { - return nil, nil, err - } - - default: - return nil, nil, fmt.Errorf("circuit with id %s is not supported", query.CircuitID) - } - - inputs, err := circuitInputs.InputsMarshal() - if err != nil { - return nil, nil, err - } - - log.Debug(ctx, "Circuit inputs", "inputs", string(inputs)) - - return inputs, claims, nil -} - -func (p *Proof) prepareAtomicQuerySigV2Circuit(ctx context.Context, did *w3c.DID, query ports.Query) (circuits.InputsMarshaller, *domain.Claim, error) { - claim, claimNonRevProof, err := p.getClaimDataForAtomicQueryCircuit(ctx, did, query) - if err != nil { - return nil, nil, err - } - - sigProof, err := claim.GetBJJSignatureProof2021() - if err != nil { - return nil, nil, err - } - - sig, err := signer.BJJSignatureFromHexString(sigProof.Signature) - if err != nil { - return nil, nil, err - } - - issuerDID, err := w3c.ParseDID(claim.Issuer) - if err != nil { - return nil, nil, err - } - - issuerAuthNonRevProof, err := p.callNonRevProof(ctx, sigProof.IssuerData, issuerDID) - if err != nil { - return nil, nil, err - } - - circuitQuery, err := p.toCircuitsQuery(ctx, *claim, query) - if err != nil { - return nil, nil, err - } - - authClaim := &core.Claim{} - err = authClaim.FromHex(sigProof.IssuerData.AuthCoreClaim) - if err != nil { - return nil, nil, err - } - - sig1 := circuits.BJJSignatureProof{ - Signature: sig, - IssuerAuthClaim: authClaim, - IssuerAuthIncProof: circuits.MTProof{ - Proof: sigProof.IssuerData.MTP, - TreeState: circuits.TreeState{ - State: common.StrMTHex(sigProof.IssuerData.State.Value), - ClaimsRoot: common.StrMTHex(sigProof.IssuerData.State.ClaimsTreeRoot), - RevocationRoot: common.StrMTHex(sigProof.IssuerData.State.RevocationTreeRoot), - RootOfRoots: common.StrMTHex(sigProof.IssuerData.State.RootOfRoots), - }, - }, - IssuerAuthNonRevProof: issuerAuthNonRevProof, - } - - id, err := core.IDFromDID(*did) - if err != nil { - return nil, nil, err - } - - inputs := circuits.AtomicQuerySigV2Inputs{ - RequestID: big.NewInt(defaultAtomicCircuitsID), - ID: &id, - ProfileNonce: big.NewInt(0), - ClaimSubjectProfileNonce: big.NewInt(0), - Claim: circuits.ClaimWithSigProof{ - IssuerID: &id, - Claim: claim.CoreClaim.Get(), - NonRevProof: *claimNonRevProof, - SignatureProof: sig1, - }, - Query: circuitQuery, - CurrentTimeStamp: time.Now().Unix(), - SkipClaimRevocationCheck: query.SkipClaimRevocationCheck, - } - - return inputs, claim, nil -} - -func (p *Proof) prepareAtomicQueryMTPV2Circuit(ctx context.Context, did *w3c.DID, query ports.Query) (circuits.InputsMarshaller, *domain.Claim, error) { - claim, claimNonRevProof, err := p.getClaimDataForAtomicQueryCircuit(ctx, did, query) - if err != nil { - return nil, nil, err - } - - claimInc, err := claim.GetCircuitIncProof() - if err != nil { - return nil, nil, err - } - - circuitQuery, err := p.toCircuitsQuery(ctx, *claim, query) - if err != nil { - return nil, nil, err - } - - id, err := core.IDFromDID(*did) - if err != nil { - return nil, nil, err - } - - inputs := circuits.AtomicQueryMTPV2Inputs{ - RequestID: big.NewInt(defaultAtomicCircuitsID), - ID: &id, - ProfileNonce: big.NewInt(0), - ClaimSubjectProfileNonce: big.NewInt(0), - Claim: circuits.ClaimWithMTPProof{ - IssuerID: &id, // claim.Issuer, - Claim: claim.CoreClaim.Get(), - NonRevProof: *claimNonRevProof, - IncProof: claimInc, - }, - Query: circuitQuery, - CurrentTimeStamp: time.Now().Unix(), - SkipClaimRevocationCheck: query.SkipClaimRevocationCheck, - } - - return inputs, claim, nil -} - -func (p *Proof) getClaimDataForAtomicQueryCircuit(ctx context.Context, identifier *w3c.DID, query ports.Query) (claim *domain.Claim, revStatus *circuits.MTProof, err error) { - var claims []*domain.Claim - - if query.ClaimID != "" { - // if claimID exist. Search by claimID. - claimUUID, err := uuid.Parse(query.ClaimID) - if err != nil { - return nil, nil, err - } - var c *domain.Claim - c, err = p.claimSrv.GetByID(ctx, identifier, claimUUID) - if err != nil { - return nil, nil, err - } - // we need to be sure that the hallmark selected by ID matches circuitQuery. - claims = append(claims, c) - } else { - // if claimID NOT exist in request select all claims and filter it. - claims, err = p.findClaimForQuery(ctx, identifier, query) - if err != nil { - return claim, nil, err - } - } - - var claimRs circuits.MTProof - if query.SkipClaimRevocationCheck { - claim = claims[0] - rsClaim, err := p.checkRevocationStatus(ctx, claim) - if err != nil { - return claim, nil, err - } - claimRs = circuits.MTProof{ - TreeState: domain.RevocationStatusToTreeState(*rsClaim), - Proof: &rsClaim.MTP, - } - } else { - claim, claimRs, err = p.findNonRevokedClaim(ctx, claims) - if err != nil { - return claim, nil, err - } - } - return claim, &claimRs, nil -} - -func (p *Proof) findClaimForQuery(ctx context.Context, identifier *w3c.DID, query ports.Query) ([]*domain.Claim, error) { - var err error - - // TODO "query_value": value, - // TODO "query_operator": operator, - filter := &ports.ClaimsFilter{SchemaType: query.SchemaType()} - if !query.SkipClaimRevocationCheck { - filter.Revoked = common.ToPointer(false) - } - - claim, _, err := p.claimsRepository.GetAllByIssuerID(ctx, p.storage.Pgx, *identifier, filter) - if errors.Is(err, repositories.ErrClaimDoesNotExist) { - return nil, fmt.Errorf("claim with credential type %v was not found", query) - } - - return claim, err -} - -func (p *Proof) checkRevocationStatus(ctx context.Context, claim *domain.Claim) (*verifiable.RevocationStatus, error) { - var ( - err error - claimRs *verifiable.RevocationStatus - ) - - var cs map[string]interface{} - if err = json.Unmarshal(claim.CredentialStatus.Bytes, &cs); err != nil { - return nil, fmt.Errorf("failed unmasrshal credentialStatus: %s", err) - } - issuerDID, err := w3c.ParseDID(claim.Issuer) - if err != nil { - return nil, err - } - - sigProof, err := claim.GetBJJSignatureProof2021() - if err != nil { - return nil, err - } - - claimRs, err = p.revocationSrv.Status(ctx, cs, issuerDID, &sigProof.IssuerData) - if err != nil && errors.Is(err, protocol.ErrStateNotFound) { - - bjp := new(verifiable.BJJSignatureProof2021) - if err := json.Unmarshal(claim.SignatureProof.Bytes, bjp); err != nil { - return nil, fmt.Errorf("failed parse signature proof for get genesys state: %s", err) - } - state, errIn := merkletree.NewHashFromHex(*bjp.IssuerData.State.Value) - if errIn != nil { - return nil, err - } - if common.CheckGenesisStateDID(issuerDID, state.BigInt()) != nil { - return nil, errors.New("issuer identity is not genesis and not published") - } - - return &verifiable.RevocationStatus{ - Issuer: verifiable.TreeState{ - State: bjp.IssuerData.State.Value, - RootOfRoots: bjp.IssuerData.State.RootOfRoots, - ClaimsTreeRoot: bjp.IssuerData.State.ClaimsTreeRoot, - RevocationTreeRoot: bjp.IssuerData.State.RevocationTreeRoot, - }, - MTP: merkletree.Proof{Existence: false}, - }, nil - } else if err != nil { - return nil, err - } - if claimRs.MTP.Existence { - // update revocation status - err = p.storage.Pgx.BeginFunc(ctx, func(tx pgx.Tx) error { - claim.Revoked = true - _, err = p.claimsRepository.Save(ctx, p.storage.Pgx, claim) - if err != nil { - return fmt.Errorf("can't save claim %v", err) - } - return nil - }) - if err != nil { - return nil, err - } - // claim revoked - return claimRs, nil - } - // claim not revoked - return claimRs, nil -} - -func (p *Proof) findNonRevokedClaim(ctx context.Context, claims []*domain.Claim) (*domain.Claim, circuits.MTProof, error) { - for _, claim := range claims { - rsClaim, err := p.checkRevocationStatus(ctx, claim) - if err != nil { - return nil, circuits.MTProof{}, err - } - // current claim revoked. To try next claim. - if rsClaim == nil { - continue - } - - revStatus := circuits.MTProof{ - TreeState: domain.RevocationStatusToTreeState(*rsClaim), - Proof: &rsClaim.MTP, - } - - return claim, revStatus, nil - } - return nil, circuits.MTProof{}, ErrAllClaimsRevoked -} - -func (p *Proof) toCircuitsQuery(ctx context.Context, claim domain.Claim, query ports.Query) (circuits.Query, error) { - // check if merklized - coreClaim := claim.CoreClaim.Get() - - merklizePosition, err := coreClaim.GetMerklizedPosition() - if err != nil { - return circuits.Query{}, err - } - if merklizePosition == core.MerklizedRootPositionNone { - credential, err := claim.GetVerifiableCredential() - if err != nil { - return circuits.Query{}, err - } - return p.prepareNonMerklizedQuery(ctx, credential.CredentialSchema.ID, query) - } - - return p.prepareMerklizedQuery(ctx, claim, query) -} - -func (p *Proof) prepareMerklizedQuery(ctx context.Context, claim domain.Claim, query ports.Query) (circuits.Query, error) { - vc, err := claim.GetVerifiableCredential() - if err != nil { - return circuits.Query{}, err - } - - mk, err := vc.Merklize(ctx, p.merklizeOptions...) - if err != nil { - return circuits.Query{}, err - } - - circuitQuery, field, err := parseQueryWithoutSlot(query.Req) - if err != nil { - return circuits.Query{}, err - } - - schema, err := jsonschema.Load(ctx, query.Context, p.schemaLoader) - if err != nil { - return circuits.Query{}, err - } - - fieldPath := merklize.Path{} - - if field != "" { - fieldPath, err = merklize.NewFieldPathFromContext(schema.BytesNoErr(), query.Type, field) - if err != nil { - return circuits.Query{}, err - } - } - - err = fieldPath.Prepend("https://www.w3.org/2018/credentials#credentialSubject") - if err != nil { - return circuits.Query{}, err - } - - jsonP, v, err := mk.Proof(ctx, fieldPath) - if err != nil { - return circuits.Query{}, err - } - - value, err := v.MtEntry() - if err != nil { - return circuits.Query{}, err - } - - path, err := fieldPath.MtEntry() - if err != nil { - return circuits.Query{}, err - } - - circuitQuery.ValueProof = &circuits.ValueProof{ - Path: path, - Value: value, - MTP: jsonP, - } - - return circuitQuery, nil -} - -func (p *Proof) prepareNonMerklizedQuery(ctx context.Context, jsonSchemaURL string, query ports.Query) (circuits.Query, error) { - parser := jsonSuite.Parser{} - pr := processor.InitProcessorOptions(&processor.Processor{}, - processor.WithParser(parser), - processor.WithDocumentLoader(p.schemaLoader)) - - schema, err := jsonschema.Load(ctx, jsonSchemaURL, p.schemaLoader) - if err != nil { - return circuits.Query{}, err - } - - if len(query.Req) > 1 { - return circuits.Query{}, errors.New("multiple requests are currently not supported") - } - - circuitQuery, field, err := parseQueryWithoutSlot(query.Req) - if err != nil { - return circuits.Query{}, err - } - - circuitQuery.SlotIndex, err = pr.GetFieldSlotIndex(field, query.Type, schema.BytesNoErr()) - if err != nil { - return circuits.Query{}, err - } - - return circuitQuery, nil -} - -func (p *Proof) callNonRevProof(ctx context.Context, issuerData verifiable.IssuerData, issuerDID *w3c.DID) (circuits.MTProof, error) { - nonRevProof, err := p.revocationSrv.Status(ctx, issuerData.CredentialStatus, issuerDID, &issuerData) - - if err != nil && errors.Is(err, protocol.ErrStateNotFound) { - state, errIn := merkletree.NewHashFromHex(*issuerData.State.Value) - if errIn != nil { - return circuits.MTProof{}, err - } - if common.CheckGenesisStateDID(issuerDID, state.BigInt()) != nil { - return circuits.MTProof{}, errors.New("issuer identity is not genesis and not published") - } - return circuits.MTProof{ - Proof: &merkletree.Proof{ - Existence: false, - NodeAux: nil, - }, - TreeState: domain.RevocationStatusToTreeState(verifiable.RevocationStatus{ - Issuer: verifiable.TreeState{ - State: issuerData.State.Value, - RootOfRoots: issuerData.State.RootOfRoots, - ClaimsTreeRoot: issuerData.State.ClaimsTreeRoot, - RevocationTreeRoot: issuerData.State.RevocationTreeRoot, - }, - MTP: merkletree.Proof{}, - }), - }, nil - } - - return circuits.MTProof{ - Proof: &nonRevProof.MTP, - TreeState: domain.RevocationStatusToTreeState(*nonRevProof), - }, nil -} - -func (p *Proof) prepareAuthV2Circuit(ctx context.Context, identifier *w3c.DID, challenge *big.Int) (circuits.AuthV2Inputs, error) { - authClaim, err := p.claimSrv.GetAuthClaim(ctx, identifier) - if err != nil { - return circuits.AuthV2Inputs{}, err - } - - authClaimData, err := p.fillAuthClaimData(ctx, identifier, authClaim) - if err != nil { - return circuits.AuthV2Inputs{}, err - } - signature, err := p.signChallange(ctx, authClaim, challenge) - if err != nil { - return circuits.AuthV2Inputs{}, err - } - globalTree, err := populateGlobalTree(ctx, identifier, p.stateService) - if err != nil { - return circuits.AuthV2Inputs{}, err - } - id, err := core.IDFromDID(*identifier) - if err != nil { - return circuits.AuthV2Inputs{}, err - } - circuitInputs := prepareAuthV2CircuitInputs(id, authClaimData, challenge, signature, globalTree) - return circuitInputs, nil -} - -func (p *Proof) signChallange(ctx context.Context, authClaim *domain.Claim, challenge *big.Int) (*babyjub.Signature, error) { - signingKeyID, err := p.identitySrv.GetKeyIDFromAuthClaim(ctx, authClaim) - if err != nil { - return nil, err - } - - challengeDigest := kms.BJJDigest(challenge) - - var sigBytes []byte - sigBytes, err = p.keyProvider.Sign(ctx, signingKeyID, challengeDigest) - if err != nil { - return nil, err - } - - return kms.DecodeBJJSignature(sigBytes) -} - -func (p *Proof) fillAuthClaimData(ctx context.Context, identifier *w3c.DID, authClaim *domain.Claim) (circuits.ClaimWithMTPProof, error) { - var authClaimData circuits.ClaimWithMTPProof - - err := p.storage.Pgx.BeginFunc( - ctx, func(tx pgx.Tx) error { - var errIn error - var idState *domain.IdentityState - idState, errIn = p.identitySrv.GetLatestStateByID(ctx, *identifier) - if errIn != nil { - return errIn - } - - identityTrees, errIn := p.mtService.GetIdentityMerkleTrees(ctx, tx, identifier) - if errIn != nil { - return errIn - } - - claimsTree, errIn := identityTrees.ClaimsTree() - if errIn != nil { - return errIn - } - // get index hash of authClaim - coreClaim := authClaim.CoreClaim.Get() - hIndex, errIn := coreClaim.HIndex() - if errIn != nil { - return errIn - } - - authClaimMTP, _, errIn := claimsTree.GenerateProof(ctx, hIndex, idState.TreeState().ClaimsRoot) - if errIn != nil { - return errIn - } - - authClaimData = circuits.ClaimWithMTPProof{ - Claim: coreClaim, - } - - authClaimData.IncProof = circuits.MTProof{ - Proof: authClaimMTP, - TreeState: idState.TreeState(), - } - - // revocation / non revocation MTP for the latest identity state - nonRevocationProof, errIn := identityTrees. - GenerateRevocationProof(ctx, new(big.Int).SetUint64(uint64(authClaim.RevNonce)), idState.TreeState().RevocationRoot) - - authClaimData.NonRevProof = circuits.MTProof{ - TreeState: idState.TreeState(), - Proof: nonRevocationProof, - } - - return errIn - }) - if err != nil { - return authClaimData, err - } - return authClaimData, nil -} - -func prepareAuthV2CircuitInputs(id core.ID, authClaim circuits.ClaimWithMTPProof, challenge *big.Int, signature *babyjub.Signature, globalMTP circuits.GISTProof) circuits.AuthV2Inputs { - return circuits.AuthV2Inputs{ - GenesisID: &id, - ProfileNonce: big.NewInt(0), - AuthClaim: authClaim.Claim, - AuthClaimIncMtp: authClaim.IncProof.Proof, - AuthClaimNonRevMtp: authClaim.NonRevProof.Proof, - TreeState: authClaim.IncProof.TreeState, - Signature: signature, - Challenge: challenge, - GISTProof: globalMTP, - } -} - -func populateGlobalTree(ctx context.Context, did *w3c.DID, stateService ports.StateService) (circuits.GISTProof, error) { - // get global root - gProof, err := stateService.GetGistProof(ctx, did) - if err != nil { - return circuits.GISTProof{}, err - } - - siblings := make([]*big.Int, len(gProof.Siblings)) - for i, s := range &gProof.Siblings { - siblings[i] = s - } - - proof, err := common.SmartContractProofToMtProofAdapter(common.SmartContractProof{ - Root: gProof.Root, - Existence: gProof.Existence, - Siblings: siblings, - Index: gProof.Index, - Value: gProof.Value, - AuxExistence: gProof.AuxExistence, - AuxIndex: gProof.AuxIndex, - AuxValue: gProof.AuxValue, - }) - if err != nil { - return circuits.GISTProof{}, err - } - - root, err := merkletree.NewHashFromBigInt(gProof.Root) - if err != nil { - return circuits.GISTProof{}, err - } - return circuits.GISTProof{ - Root: root, - Proof: proof, - }, nil -} - -func getValuesFromArray(v interface{}) ([]*big.Int, error) { - values := []*big.Int{} - - switch value := v.(type) { - case float64: - values = []*big.Int{new(big.Int).SetInt64(int64(value))} - case []interface{}: - for _, item := range value { - if itemFloat, ok := item.(float64); ok { - values = append(values, new(big.Int).SetInt64(int64(itemFloat))) - } else { - return nil, fmt.Errorf("unsupported values type in value element %T, expected float64", item) - } - } - default: - return nil, fmt.Errorf("unsupported values type %T", v) - } - - return values, nil -} - -func parseQueryWithoutSlot(req map[string]interface{}) (circuits.Query, string, error) { - for field, body := range req { - condition, ok := body.(map[string]interface{}) - - if !ok { - return circuits.Query{}, "", errors.New("failed cast type map[string]interface") - } - - if len(condition) > 1 { - return circuits.Query{}, "", errors.New("multiple predicates are currently not supported") - } - - for op, v := range condition { - - intOp, ok := circuits.QueryOperators[op] - if !ok { - return circuits.Query{}, "", errors.New("query operator is not supported") - } - - values, err := getValuesFromArray(v) - if err != nil { - return circuits.Query{}, "", err - } - - return circuits.Query{ - Operator: intOp, - Values: values, - }, field, nil - } - } - return circuits.Query{ - Operator: 0, - Values: []*big.Int{}, - SlotIndex: 0, - }, "", nil -} diff --git a/internal/core/services/revocation.go b/internal/core/services/revocation.go deleted file mode 100644 index 3740537fb..000000000 --- a/internal/core/services/revocation.go +++ /dev/null @@ -1,482 +0,0 @@ -package services - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "math/big" - "net/http" - "net/url" - "strconv" - "strings" - "time" - - ethCommon "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" - abiOnchain "github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi" - "github.com/iden3/contracts-abi/state/go/abi" - core "github.com/iden3/go-iden3-core/v2" - "github.com/iden3/go-iden3-core/v2/w3c" - "github.com/iden3/go-merkletree-sql/v2" - "github.com/iden3/go-schema-processor/v2/verifiable" - "github.com/iden3/iden3comm/v2" - "github.com/iden3/iden3comm/v2/packers" - "github.com/iden3/iden3comm/v2/protocol" - proofHttp "github.com/iden3/merkletree-proof/http" - - "github.com/polygonid/sh-id-platform/internal/common" - "github.com/polygonid/sh-id-platform/internal/core/ports" - "github.com/polygonid/sh-id-platform/internal/log" - client "github.com/polygonid/sh-id-platform/pkg/http" -) - -const ( - defaultRevocationTime = 30 - stateChildrenLength = 3 - contractPartsLength = 2 -) - -// ErrIdentityDoesNotExist - identity does not exist -var ErrIdentityDoesNotExist = errors.New("identity does not exist") - -// StateStore TBD -type StateStore interface { - GetLatestStateByID(ctx context.Context, addr ethCommon.Address, id *big.Int) (abi.IStateStateInfo, error) -} - -type onChainStatusService interface { - GetRevocationStatus(ctx context.Context, state *big.Int, nonce uint64, did *w3c.DID, address ethCommon.Address) (abiOnchain.IOnchainCredentialStatusResolverCredentialStatus, error) -} - -// Revocation TBD -type Revocation struct { - stateService ports.StateService - onChainStatusService onChainStatusService - contract ethCommon.Address -} - -// NewRevocationService returns the Revocation struct -func NewRevocationService(contract ethCommon.Address, stateService ports.StateService, onChainStatusService onChainStatusService) *Revocation { - return &Revocation{ - contract: contract, - stateService: stateService, - onChainStatusService: onChainStatusService, - } -} - -// Status returns the current revocation status -func (r *Revocation) Status(ctx context.Context, credStatus interface{}, issuerDID *w3c.DID, issuerData *verifiable.IssuerData) (*verifiable.RevocationStatus, error) { - status, err := convertCredentialStatus(credStatus) - if err != nil { - log.Error(ctx, "failed convert credential status", "error", err) - return nil, err - } - switch status.Type { - case verifiable.Iden3ReverseSparseMerkleTreeProof: - return r.getRevocationStatusFromRHS(ctx, issuerDID, status, issuerData) - case verifiable.SparseMerkleTreeProof: - return getRevocationProofFromIssuer(ctx, status.ID) - case verifiable.Iden3commRevocationStatusV1: - return getRevocationStatusFromAgent(ctx, issuerDID.String(), - issuerDID.String(), status.ID, status.RevocationNonce) - case verifiable.Iden3OnchainSparseMerkleTreeProof2023: - return r.getRevocationStatusFromOnchainCredStatusResolver(ctx, issuerDID, status) - default: - return nil, fmt.Errorf("%s type not supported", status.Type) - } -} - -func convertCredentialStatus(credStatus interface{}) (verifiable.CredentialStatus, error) { - status, ok := credStatus.(verifiable.CredentialStatus) - if ok { - return status, nil - } - pointedStatus, ok := credStatus.(*verifiable.CredentialStatus) - if ok { - return *pointedStatus, nil - } - _, ok = credStatus.(map[string]interface{}) - if ok { - b, err := json.Marshal(credStatus) - if err != nil { - return verifiable.CredentialStatus{}, err - } - var status verifiable.CredentialStatus - err = json.Unmarshal(b, &status) - if err != nil { - return verifiable.CredentialStatus{}, err - } - return status, nil - } - - return verifiable.CredentialStatus{}, errors.New("failed cast credential status to verifiable.CredentialStatus") -} - -func getRevocationStatusFromAgent(ctx context.Context, from, to, endpoint string, nonce uint64) (*verifiable.RevocationStatus, error) { - pkg := iden3comm.NewPackageManager() - if err := pkg.RegisterPackers(&packers.PlainMessagePacker{}); err != nil { - return nil, err - } - - revocationBody := protocol.RevocationStatusRequestMessageBody{ - RevocationNonce: nonce, - } - rawBody, err := json.Marshal(revocationBody) - if err != nil { - return nil, err - } - - msg := iden3comm.BasicMessage{ - ID: uuid.New().String(), - ThreadID: uuid.New().String(), - From: from, - To: to, - Type: protocol.RevocationStatusRequestMessageType, - Body: rawBody, - } - bytesMsg, err := json.Marshal(msg) - if err != nil { - return nil, err - } - - iden3commMsg, err := pkg.Pack(packers.MediaTypePlainMessage, bytesMsg, nil) - if err != nil { - return nil, err - } - - resp, err := http.DefaultClient.Post(endpoint, "application/json", bytes.NewBuffer(iden3commMsg)) - if err != nil { - return nil, err - } - defer func() { - if err := resp.Body.Close(); err != nil { - log.Warn(ctx, "failed to close response body: %s", err) - } - }() - - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("bad status code: %d", resp.StatusCode) - } - - b, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - basicMessage, _, err := pkg.Unpack(b) - if err != nil { - return nil, err - } - - if basicMessage.Type != protocol.RevocationStatusResponseMessageType { - return nil, fmt.Errorf("unexpected message type: %s", basicMessage.Type) - } - - var revocationStatus protocol.RevocationStatusResponseMessageBody - if err := json.Unmarshal(basicMessage.Body, &revocationStatus); err != nil { - return nil, err - } - - return &revocationStatus.RevocationStatus, nil -} - -func getRevocationProofFromIssuer(ctx context.Context, url string) (*verifiable.RevocationStatus, error) { - b, err := client.NewClient(*http.DefaultClient).Get(ctx, url) - if err != nil { - return nil, err - } - - rs := &verifiable.RevocationStatus{} - if err := json.Unmarshal(b, rs); err != nil { - return nil, err - } - return rs, nil -} - -func getNonRevocationProofFromRHS(ctx context.Context, rhsURL string, data, issuerRoot *merkletree.Hash) (*verifiable.RevocationStatus, error) { - rhsCli := proofHttp.ReverseHashCli{ - URL: rhsURL, - HTTPTimeout: time.Second * defaultRevocationTime, - } - - treeRoots, err := rhsCli.GetNode(ctx, issuerRoot) - if err != nil { - return nil, err - } - if len(treeRoots.Children) != stateChildrenLength { - return nil, fmt.Errorf("state should has tree children") - } - - var ( - s = issuerRoot.Hex() - CTR = treeRoots.Children[0].Hex() - RTR = treeRoots.Children[1].Hex() - RoTR = treeRoots.Children[2].Hex() - ) - - rtrHashed, err := merkletree.NewHashFromString(RTR) - if err != nil { - return nil, err - } - nonRevProof, err := rhsCli.GenerateProof(ctx, rtrHashed, data) - if err != nil { - return nil, fmt.Errorf("failed generate proof for root '%s' and element '%s': %s", - issuerRoot, data, err) - } - - return &verifiable.RevocationStatus{ - Issuer: verifiable.TreeState{ - State: &s, - ClaimsTreeRoot: &CTR, - RevocationTreeRoot: &RTR, - RootOfRoots: &RoTR, - }, - MTP: *nonRevProof, - }, nil -} - -func (r *Revocation) getRevocationStatusFromRHS(ctx context.Context, issuerDID *w3c.DID, status verifiable.CredentialStatus, issuerData *verifiable.IssuerData) (*verifiable.RevocationStatus, error) { - latestStateInfo, err := r.stateService.GetLatestStateByDID(ctx, issuerDID) - if err != nil && strings.Contains(err.Error(), ErrIdentityDoesNotExist.Error()) { - - currentState, err := extractState(status.ID) - if err != nil { - log.Error(ctx, "failed extract state from rhs id", "error", err) - return nil, err - } - if currentState == "" { - return getRevocationStatusFromIssuerData(issuerDID, issuerData) - } else { - latestStateInfo.State, err = getGenesisState(issuerDID, currentState) - if err != nil { - return nil, fmt.Errorf("failed get genesis state for issuer '%s'", issuerDID) - } - } - - } else if err != nil { - return nil, fmt.Errorf("failed get latest state by did '%s'", issuerDID.String()) - } - - hashedRevNonce, err := merkletree.NewHashFromBigInt(big.NewInt(int64(status.RevocationNonce))) - if err != nil { - return nil, fmt.Errorf("failed calculate mt hash for revocation nonce '%d': '%s'", - status.RevocationNonce, err) - } - - hashedIssuerState, err := merkletree.NewHashFromBigInt(latestStateInfo.State) - if err != nil { - return nil, fmt.Errorf("failed calcilate mt hash for issuer state '%s': '%s'", - latestStateInfo.State, err) - } - - u := strings.Split(status.ID, "/node") - rs, err := getNonRevocationProofFromRHS(ctx, u[0], hashedRevNonce, hashedIssuerState) - if err != nil && status.StatusIssuer.Type == verifiable.SparseMerkleTreeProof { - // try to get proof from issuer - log.Warn(ctx, "failed build revocation status from enabled RHS. Then try to fetch from issuer. RHS error: %v", err) - revocStatus, err := getRevocationProofFromIssuer(ctx, status.StatusIssuer.ID) - if err != nil { - return nil, err - } - return revocStatus, nil - } - return rs, nil -} - -func extractState(id string) (string, error) { - rhsULR, err := url.Parse(id) - if err != nil { - return "", fmt.Errorf("invalid rhs id filed '%s'", id) - } - params, err := url.ParseQuery(rhsULR.RawQuery) - if err != nil { - return "", fmt.Errorf("invalid rhs params '%s'", rhsULR.RawQuery) - } - return params.Get("state"), nil -} - -func getRevocationStatusFromIssuerData(did *w3c.DID, issuerData *verifiable.IssuerData) (*verifiable.RevocationStatus, error) { - if issuerData == nil || issuerData.State.Value == nil { - return nil, errors.New("issuer data state is empty. is not possible verify revocation status") - } - h, err := merkletree.NewHashFromHex(*issuerData.State.Value) - if err != nil { - return nil, fmt.Errorf("failed parse hex '%s'", *issuerData.State.Value) - } - err = common.CheckGenesisStateDID(did, h.BigInt()) - if err != nil { - return nil, fmt.Errorf("failed check genesis state for issuer '%s'", did) - } - - return &verifiable.RevocationStatus{ - Issuer: verifiable.TreeState{ - State: issuerData.State.Value, - RootOfRoots: issuerData.State.RootOfRoots, - ClaimsTreeRoot: issuerData.State.ClaimsTreeRoot, - RevocationTreeRoot: issuerData.State.RevocationTreeRoot, - }, - MTP: merkletree.Proof{Existence: false}, - }, nil -} - -func getGenesisState(did *w3c.DID, currentState string) (*big.Int, error) { - h, err := merkletree.NewHashFromHex(currentState) - if err != nil { - return nil, fmt.Errorf("failed parse hex '%s'", currentState) - } - err = common.CheckGenesisStateDID(did, h.BigInt()) - if err != nil { - return nil, fmt.Errorf("failed check genesis state for issuer '%s'", did) - } - return h.BigInt(), nil -} - -func (r *Revocation) getRevocationStatusFromOnchainCredStatusResolver(ctx context.Context, issuerDID *w3c.DID, status verifiable.CredentialStatus) (*verifiable.RevocationStatus, error) { - issuerID, err := core.IDFromDID(*issuerDID) - if err != nil { - return nil, fmt.Errorf("failed get issuer id from '%s'", issuerDID) - } - - onchainRevStatus, err := newOnchainRevStatusFromURI(status.ID) - if err != nil { - return nil, err - } - - if onchainRevStatus.revNonce != nil && *onchainRevStatus.revNonce != status.RevocationNonce { - return nil, fmt.Errorf("revocationNonce is not equal to the one in OnChainCredentialStatus ID {%d} {%d}", onchainRevStatus.revNonce, status.RevocationNonce) - } - - // get latest state from contract - var stateToProof *big.Int - latestStateInfo, err := r.stateService.GetLatestStateByDID(ctx, issuerDID) - //nolint:gocritic //reason: work with errors - if err != nil && strings.Contains(err.Error(), ErrIdentityDoesNotExist.Error()) { - if onchainRevStatus.state == nil { - return nil, errors.New(`latest state not found and state parameter is not present in credentialStatus.id`) - } - err = common.CheckGenesisStateDID(issuerDID, onchainRevStatus.state) - if err != nil { - return nil, err - } - stateToProof = onchainRevStatus.state - - } else if err != nil { - return nil, fmt.Errorf("failed get latest state by id '%s'", issuerID) - } else { - stateToProof = latestStateInfo.State - } - - rs, err := r.onChainStatusService.GetRevocationStatus( - ctx, stateToProof, status.RevocationNonce, issuerDID, onchainRevStatus.contractAddress, - ) - if err != nil { - return nil, errors.New("failed get revocation status from onchain cred status resolver") - } - - smProof, err := common.SmartContractProofToMtProofAdapter(common.SmartContractProof{ - Root: rs.Mtp.Root, - Existence: rs.Mtp.Existence, - Siblings: rs.Mtp.Siblings, - Index: rs.Mtp.Index, - Value: rs.Mtp.Value, - AuxExistence: rs.Mtp.AuxExistence, - AuxIndex: rs.Mtp.AuxIndex, - AuxValue: rs.Mtp.AuxValue, - }) - if err != nil { - log.Error(ctx, "failed convert smart contract proof to merkle tree proof", "error", err) - return nil, err - } - - state, err := merkletree.NewHashFromBigInt(rs.Issuer.State) - if err != nil { - log.Error(ctx, "failed convert state to merkle tree hash", "error", err) - return nil, err - } - stateHex := state.Hex() - ctr, err := merkletree.NewHashFromBigInt(rs.Issuer.ClaimsTreeRoot) - if err != nil { - return nil, err - } - ctrHex := ctr.Hex() - - rtr, err := merkletree.NewHashFromBigInt(rs.Issuer.RevocationTreeRoot) - if err != nil { - log.Error(ctx, "failed convert revocation tree root to merkle tree hash", "error", err) - return nil, err - } - rtrHex := rtr.Hex() - - ror, err := merkletree.NewHashFromBigInt(rs.Issuer.RootOfRoots) - if err != nil { - log.Error(ctx, "failed convert root of roots to merkle tree hash", "error", err) - return nil, err - } - rorHex := ror.Hex() - - return &verifiable.RevocationStatus{ - Issuer: verifiable.TreeState{ - State: &stateHex, - ClaimsTreeRoot: &ctrHex, - RevocationTreeRoot: &rtrHex, - RootOfRoots: &rorHex, - }, - MTP: *smProof, - }, nil -} - -type onchainRevStatus struct { - contractAddress ethCommon.Address - revNonce *uint64 - state *big.Int -} - -func newOnchainRevStatusFromURI(id string) (onchainRevStatus, error) { - var s onchainRevStatus - - uri, err := url.Parse(id) - if err != nil { - return s, errors.New("OnChainCredentialStatus ID is not a valid URI") - } - - contract := uri.Query().Get("contractAddress") - if contract == "" { - return s, errors.New("OnChainCredentialStatus contract address is empty") - } - - contractParts := strings.Split(contract, ":") - if len(contractParts) != contractPartsLength { - return s, errors.New( - "OnChainCredentialStatus contract address is not valid") - } - if !ethCommon.IsHexAddress(contractParts[1]) { - return s, errors.New( - "OnChainCredentialStatus incorrect contract address") - } - s.contractAddress = ethCommon.HexToAddress(contractParts[1]) - - revocationNonce := uri.Query().Get("revocationNonce") - // revnonce may be nil if params is absent in query - if revocationNonce != "" { - n, err := strconv.ParseUint(revocationNonce, 10, 64) - if err != nil { - return s, errors.New("revocationNonce is not a number in OnChainCredentialStatus ID") - } - s.revNonce = &n - } - // state may be nil if params is absent in query - stateParam := uri.Query().Get("state") - if stateParam == "" { - s.state = nil - } else { - stateHash, err := merkletree.NewHashFromHex(stateParam) - if err != nil { - return s, err - } - s.state = stateHash.BigInt() - } - - return s, nil -} diff --git a/pkg/protocol/packagemanager.go b/pkg/protocol/packagemanager.go index 35dc29846..f19f01c7a 100644 --- a/pkg/protocol/packagemanager.go +++ b/pkg/protocol/packagemanager.go @@ -1,23 +1,19 @@ package protocol import ( - "context" "fmt" - "math/big" "github.com/iden3/contracts-abi/state/go/abi" "github.com/iden3/go-circuits/v2" - "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-jwz/v2" "github.com/iden3/iden3comm/v2" "github.com/iden3/iden3comm/v2/packers" - "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/pkg/loaders" ) // InitPackageManager initializes the iden3comm package manager -func InitPackageManager(ctx context.Context, stateContract *abi.State, zkProofService ports.ProofService, circuitsPath string) (*iden3comm.PackageManager, error) { +func InitPackageManager(stateContract *abi.State, circuitsPath string) (*iden3comm.PackageManager, error) { circuitsLoaderService := loaders.NewCircuits(circuitsPath) authV2Set, err := circuitsLoaderService.Load(circuits.AuthV2CircuitID) @@ -25,27 +21,11 @@ func InitPackageManager(ctx context.Context, stateContract *abi.State, zkProofSe return nil, fmt.Errorf("failed upload circuits files: %w", err) } - provers := make(map[jwz.ProvingMethodAlg]packers.ProvingParams) - pParams := packers.ProvingParams{ - DataPreparer: prepareAuthInputs(ctx, zkProofService), - ProvingKey: authV2Set.ProofKey, - Wasm: authV2Set.Wasm, - } - provers[jwz.AuthV2Groth16Alg] = pParams - verifications := make(map[jwz.ProvingMethodAlg]packers.VerificationParams) - verifications[jwz.AuthV2Groth16Alg] = packers.NewVerificationParams(authV2Set.VerificationKey, - stateVerificationHandler(stateContract)) - - zkpPackerV2 := packers.NewZKPPacker( - provers, - verifications, - ) - - // TODO: Why jwsPacker is not defined here? + verifications[jwz.AuthV2Groth16Alg] = packers.NewVerificationParams(authV2Set.VerificationKey, stateVerificationHandler(stateContract)) + zkpPackerV2 := packers.NewZKPPacker(nil, verifications) packageManager := iden3comm.NewPackageManager() - err = packageManager.RegisterPackers(zkpPackerV2, &packers.PlainMessagePacker{}) if err != nil { return nil, err @@ -53,16 +33,3 @@ func InitPackageManager(ctx context.Context, stateContract *abi.State, zkProofSe return packageManager, err } - -func prepareAuthInputs(ctx context.Context, proofService ports.ProofService) packers.DataPreparerHandlerFunc { - return func(hash []byte, id *w3c.DID, circuitID circuits.CircuitID) ([]byte, error) { - q := ports.Query{} - q.CircuitID = string(circuitID) - q.Challenge = new(big.Int).SetBytes(hash) - circuitInputs, _, err := proofService.PrepareInputs(ctx, id, q) - if err != nil { - return nil, err - } - return circuitInputs, nil - } -}