Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve address regex #294

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions packages/runtime/src/useCases/common/Schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2982,7 +2982,7 @@ export const CanCreateOutgoingRequestRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -10800,7 +10800,7 @@ export const CreateOutgoingRequestRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -14904,7 +14904,7 @@ export const CreateAndShareRelationshipAttributeRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -17110,7 +17110,7 @@ export const GetOwnSharedAttributesRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
},
"GetOwnSharedAttributeRequestQuery": {
"type": "object",
Expand Down Expand Up @@ -17340,7 +17340,7 @@ export const GetPeerSharedAttributesRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
},
"GetPeerSharedAttributesRequestQuery": {
"type": "object",
Expand Down Expand Up @@ -17642,7 +17642,7 @@ export const GetSharedVersionsOfAttributeRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -17696,7 +17696,7 @@ export const NotifyPeerAboutRepositoryAttributeSuccessionRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -17763,7 +17763,7 @@ export const ShareRepositoryAttributeRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
},
"ISO8601DateTimeString": {
"type": "string",
Expand Down Expand Up @@ -19986,7 +19986,7 @@ export const DeleteIdentityMetadataRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand All @@ -20012,7 +20012,7 @@ export const GetIdentityMetadataRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -20040,7 +20040,7 @@ export const UpsertIdentityMetadataRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -21259,7 +21259,7 @@ export const CreateTokenForFileRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -21297,7 +21297,7 @@ export const CreateTokenQRCodeForFileRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -21937,7 +21937,7 @@ export const SendMessageRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
},
"FileIdString": {
"type": "string",
Expand Down Expand Up @@ -22035,7 +22035,7 @@ export const CreateTokenForOwnTemplateRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -22073,7 +22073,7 @@ export const CreateTokenQRCodeForOwnTemplateRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -22411,7 +22411,7 @@ export const GetRelationshipByAddressRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down Expand Up @@ -22647,7 +22647,7 @@ export const CreateOwnTokenRequest: any = {
},
"AddressString": {
"type": "string",
"pattern": "did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}"
"pattern": "did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @pattern did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}
* @pattern did:e:((([A-Za-z0-9]+(-[A-Za-z0-9]+)*)\.)+[a-z]{2,}|localhost):dids:[0-9a-f]{22}
*/
export type AddressString = string;

Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/test/consumption/attributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ describe("Get (shared) versions of attribute", () => {
test("should return an empty list calling getSharedVersionsOfAttribute with a nonexistent peer", async () => {
const result = await services1.consumption.attributes.getSharedVersionsOfAttribute({
attributeId: sRepositoryAttributeVersion2.id,
peers: ["did:e:a-domain:dids:0000000000000000000000"]
peers: ["did:e:localhost:dids:0000000000000000000000"]
});
expect(result.isSuccess).toBe(true);
const returnedVersions = result.value;
Expand Down