Skip to content

Commit 161a773

Browse files
Merge upstream develop
2 parents 05cb8df + 126f944 commit 161a773

39 files changed

Lines changed: 1468 additions & 322 deletions

apps/polycentric/src/features/verifications/hooks/useCreateClaim.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ export default function useCreateClaim() {
2626
submit: async ({
2727
schema,
2828
values,
29-
targetIdentities = [],
3029
}: {
3130
schema: v2.VerificationSchema;
3231
values: Record<string, string>;
33-
targetIdentities?: string[];
3432
}): Promise<ClaimRef | undefined> => {
3533
if (isPending) {
3634
throw 'Already pending';
@@ -52,7 +50,6 @@ export default function useCreateClaim() {
5250
verificationClaim: {
5351
schema: serializeSchema(schema),
5452
fields,
55-
targetIdentities,
5653
},
5754
},
5855
});

packages/js-core/src/proto/polycentric/v2/content.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { reflectionMergePartial } from "@protobuf-ts/runtime";
1313
import { MessageType } from "@protobuf-ts/runtime";
1414
import { ContentDigest } from "./common";
1515
import { EventKey } from "./event_key";
16+
import { VerificationTarget } from "./verifications";
1617
import { VerificationVerify } from "./verifications";
1718
import { VerificationClaim } from "./verifications";
1819
import { Identity } from "./identity";
@@ -99,6 +100,12 @@ export interface Content {
99100
* @generated from protobuf field: polycentric.v2.VerificationVerify verification_verify = 13
100101
*/
101102
verificationVerify: VerificationVerify;
103+
} | {
104+
oneofKind: "verificationTarget";
105+
/**
106+
* @generated from protobuf field: polycentric.v2.VerificationTarget verification_target = 14
107+
*/
108+
verificationTarget: VerificationTarget;
102109
} | {
103110
oneofKind: undefined;
104111
};
@@ -500,7 +507,8 @@ class Content$Type extends MessageType<Content> {
500507
{ no: 10, name: "report", kind: "message", oneof: "contentBody", T: () => Report },
501508
{ no: 11, name: "labels", kind: "message", oneof: "contentBody", T: () => Labels },
502509
{ no: 12, name: "verification_claim", kind: "message", oneof: "contentBody", T: () => VerificationClaim },
503-
{ no: 13, name: "verification_verify", kind: "message", oneof: "contentBody", T: () => VerificationVerify }
510+
{ no: 13, name: "verification_verify", kind: "message", oneof: "contentBody", T: () => VerificationVerify },
511+
{ no: 14, name: "verification_target", kind: "message", oneof: "contentBody", T: () => VerificationTarget }
504512
]);
505513
}
506514
create(value?: PartialMessage<Content>): Content {
@@ -587,6 +595,12 @@ class Content$Type extends MessageType<Content> {
587595
verificationVerify: VerificationVerify.internalBinaryRead(reader, reader.uint32(), options, (message.contentBody as any).verificationVerify)
588596
};
589597
break;
598+
case /* polycentric.v2.VerificationTarget verification_target */ 14:
599+
message.contentBody = {
600+
oneofKind: "verificationTarget",
601+
verificationTarget: VerificationTarget.internalBinaryRead(reader, reader.uint32(), options, (message.contentBody as any).verificationTarget)
602+
};
603+
break;
590604
default:
591605
let u = options.readUnknownField;
592606
if (u === "throw")
@@ -635,6 +649,9 @@ class Content$Type extends MessageType<Content> {
635649
/* polycentric.v2.VerificationVerify verification_verify = 13; */
636650
if (message.contentBody.oneofKind === "verificationVerify")
637651
VerificationVerify.internalBinaryWrite(message.contentBody.verificationVerify, writer.tag(13, WireType.LengthDelimited).fork(), options).join();
652+
/* polycentric.v2.VerificationTarget verification_target = 14; */
653+
if (message.contentBody.oneofKind === "verificationTarget")
654+
VerificationTarget.internalBinaryWrite(message.contentBody.verificationTarget, writer.tag(14, WireType.LengthDelimited).fork(), options).join();
638655
let u = options.writeUnknownFields;
639656
if (u !== false)
640657
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);

packages/js-core/src/proto/polycentric/v2/verifications.ts

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,24 @@ export interface VerificationClaim {
115115
fields: {
116116
[key: string]: Uint8Array;
117117
};
118+
}
119+
/**
120+
* Targets a claim at one or more identities. Separate from the claim so
121+
* targeting can be set (or changed) after the claim is created.
122+
*
123+
* @generated from protobuf message polycentric.v2.VerificationTarget
124+
*/
125+
export interface VerificationTarget {
126+
/**
127+
* The claim event being targeted.
128+
*
129+
* @generated from protobuf field: polycentric.v2.EventKey claim_event_key = 1
130+
*/
131+
claimEventKey?: EventKey;
118132
/**
119-
* Identities this claim is intended for
133+
* Identities the claim is intended for.
120134
*
121-
* @generated from protobuf field: repeated string target_identities = 3
135+
* @generated from protobuf field: repeated string target_identities = 2
122136
*/
123137
targetIdentities: string[];
124138
}
@@ -379,14 +393,12 @@ class VerificationClaim$Type extends MessageType<VerificationClaim> {
379393
constructor() {
380394
super("polycentric.v2.VerificationClaim", [
381395
{ no: 1, name: "schema", kind: "message", T: () => SerializedVerificationSchema },
382-
{ no: 2, name: "fields", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 12 /*ScalarType.BYTES*/ } },
383-
{ no: 3, name: "target_identities", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
396+
{ no: 2, name: "fields", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 12 /*ScalarType.BYTES*/ } }
384397
]);
385398
}
386399
create(value?: PartialMessage<VerificationClaim>): VerificationClaim {
387400
const message = globalThis.Object.create((this.messagePrototype!));
388401
message.fields = {};
389-
message.targetIdentities = [];
390402
if (value !== undefined)
391403
reflectionMergePartial<VerificationClaim>(this, message, value);
392404
return message;
@@ -402,9 +414,6 @@ class VerificationClaim$Type extends MessageType<VerificationClaim> {
402414
case /* map<string, bytes> fields */ 2:
403415
this.binaryReadMap2(message.fields, reader, options);
404416
break;
405-
case /* repeated string target_identities */ 3:
406-
message.targetIdentities.push(reader.string());
407-
break;
408417
default:
409418
let u = options.readUnknownField;
410419
if (u === "throw")
@@ -439,9 +448,6 @@ class VerificationClaim$Type extends MessageType<VerificationClaim> {
439448
/* map<string, bytes> fields = 2; */
440449
for (let k of globalThis.Object.keys(message.fields))
441450
writer.tag(2, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).bytes(message.fields[k]).join();
442-
/* repeated string target_identities = 3; */
443-
for (let i = 0; i < message.targetIdentities.length; i++)
444-
writer.tag(3, WireType.LengthDelimited).string(message.targetIdentities[i]);
445451
let u = options.writeUnknownFields;
446452
if (u !== false)
447453
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -453,6 +459,60 @@ class VerificationClaim$Type extends MessageType<VerificationClaim> {
453459
*/
454460
export const VerificationClaim = new VerificationClaim$Type();
455461
// @generated message type with reflection information, may provide speed optimized methods
462+
class VerificationTarget$Type extends MessageType<VerificationTarget> {
463+
constructor() {
464+
super("polycentric.v2.VerificationTarget", [
465+
{ no: 1, name: "claim_event_key", kind: "message", T: () => EventKey },
466+
{ no: 2, name: "target_identities", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
467+
]);
468+
}
469+
create(value?: PartialMessage<VerificationTarget>): VerificationTarget {
470+
const message = globalThis.Object.create((this.messagePrototype!));
471+
message.targetIdentities = [];
472+
if (value !== undefined)
473+
reflectionMergePartial<VerificationTarget>(this, message, value);
474+
return message;
475+
}
476+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: VerificationTarget): VerificationTarget {
477+
let message = target ?? this.create(), end = reader.pos + length;
478+
while (reader.pos < end) {
479+
let [fieldNo, wireType] = reader.tag();
480+
switch (fieldNo) {
481+
case /* polycentric.v2.EventKey claim_event_key */ 1:
482+
message.claimEventKey = EventKey.internalBinaryRead(reader, reader.uint32(), options, message.claimEventKey);
483+
break;
484+
case /* repeated string target_identities */ 2:
485+
message.targetIdentities.push(reader.string());
486+
break;
487+
default:
488+
let u = options.readUnknownField;
489+
if (u === "throw")
490+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
491+
let d = reader.skip(wireType);
492+
if (u !== false)
493+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
494+
}
495+
}
496+
return message;
497+
}
498+
internalBinaryWrite(message: VerificationTarget, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
499+
/* polycentric.v2.EventKey claim_event_key = 1; */
500+
if (message.claimEventKey)
501+
EventKey.internalBinaryWrite(message.claimEventKey, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
502+
/* repeated string target_identities = 2; */
503+
for (let i = 0; i < message.targetIdentities.length; i++)
504+
writer.tag(2, WireType.LengthDelimited).string(message.targetIdentities[i]);
505+
let u = options.writeUnknownFields;
506+
if (u !== false)
507+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
508+
return writer;
509+
}
510+
}
511+
/**
512+
* @generated MessageType for protobuf message polycentric.v2.VerificationTarget
513+
*/
514+
export const VerificationTarget = new VerificationTarget$Type();
515+
// @generated message type with reflection information, may provide speed optimized methods
456516
class VerificationVerify$Type extends MessageType<VerificationVerify> {
457517
constructor() {
458518
super("polycentric.v2.VerificationVerify", [

packages/js-core/src/proto/polycentric/v2/verifications_service.client.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
1414
*/
1515
export interface IVerificationsServiceClient {
1616
/**
17-
* List the verification claims created by an identity.
18-
*
1917
* @generated from protobuf rpc: ListClaims
2018
*/
2119
listClaims(input: ListClaimsRequest, options?: RpcOptions): UnaryCall<ListClaimsRequest, ListClaimsResponse>;
@@ -30,8 +28,6 @@ export class VerificationsServiceClient implements IVerificationsServiceClient,
3028
constructor(private readonly _transport: RpcTransport) {
3129
}
3230
/**
33-
* List the verification claims created by an identity.
34-
*
3531
* @generated from protobuf rpc: ListClaims
3632
*/
3733
listClaims(input: ListClaimsRequest, options?: RpcOptions): UnaryCall<ListClaimsRequest, ListClaimsResponse> {

packages/js-core/src/proto/polycentric/v2/verifications_service.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
1212
import { reflectionMergePartial } from "@protobuf-ts/runtime";
1313
import { MessageType } from "@protobuf-ts/runtime";
1414
import { EventBundle } from "./events";
15-
// RPC surface for verification claims. Kept separate from
16-
// verifications.proto because the response references EventBundle
17-
// (events.proto), and events.proto -> content.proto -> verifications.proto
18-
// already form a chain; importing events.proto from verifications.proto
19-
// would create a cyclic import.
15+
// Separate from verifications.proto: that file is imported by content.proto,
16+
// so importing events.proto (for EventBundle) there would be a cyclic import.
2017

2118
/**
2219
* @generated from protobuf message polycentric.v2.ListClaimsRequest
2320
*/
2421
export interface ListClaimsRequest {
2522
/**
26-
* Identity whose verification claims to list.
27-
*
2823
* @generated from protobuf field: string claimed_by_identity = 1
2924
*/
3025
claimedByIdentity: string;
@@ -34,8 +29,6 @@ export interface ListClaimsRequest {
3429
*/
3530
export interface ListClaimsResponse {
3631
/**
37-
* Claim events created by the identity, newest first.
38-
*
3932
* @generated from protobuf field: repeated polycentric.v2.EventBundle event_bundles = 1
4033
*/
4134
eventBundles: EventBundle[];

packages/react-native/src/generated/rn/polycentric_core.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,9 +3005,8 @@ export interface PolycentricCoreLike {
30053005
*/
30063006
getServers(): Array<string>;
30073007
/**
3008-
* Clear the per-server cache for `query_key`, notify live
3009-
* subscribers with `Loading(None)`, then trigger a fresh fan-out.
3010-
* No-op when the key has never been queried.
3008+
* Clear the cache for a query key and discard the responses for any
3009+
* in-flight merge queries.
30113010
*/
30123011
invalidateQuery(queryKey: Array<string>): void;
30133012
/**
@@ -3512,9 +3511,8 @@ export class PolycentricCore
35123511
}
35133512

35143513
/**
3515-
* Clear the per-server cache for `query_key`, notify live
3516-
* subscribers with `Loading(None)`, then trigger a fresh fan-out.
3517-
* No-op when the key has never been queried.
3514+
* Clear the cache for a query key and discard the responses for any
3515+
* in-flight merge queries.
35183516
*/
35193517
invalidateQuery(queryKey: Array<string>): void {
35203518
uniffiCaller.rustCall(
@@ -4469,7 +4467,7 @@ function uniffiEnsureInitialized() {
44694467
}
44704468
if (
44714469
nativeModule().ubrn_uniffi_polycentric_core_checksum_method_polycentriccore_invalidate_query() !==
4472-
34463
4470+
44746
44734471
) {
44744472
throw new UniffiInternalError.ApiChecksumMismatch(
44754473
'uniffi_polycentric_core_checksum_method_polycentriccore_invalidate_query'

packages/rs-core/src/query/claims.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ pub struct ListClaimsArgs {
1515
pub claimed_by_identity: String,
1616
}
1717

18-
/// Merge `ListClaimsResponse` payloads from every server: concatenate
19-
/// the bundles, dedupe by `EventKey`, then drop any that fail signature
20-
/// / proof validation against the local client state.
18+
/// Concatenate per-server bundles, dedupe by `EventKey`, drop invalid ones.
2119
fn merge_list_claims_responses(
2220
values: &[Vec<u8>],
2321
client: &std::sync::Arc<std::sync::Mutex<crate::client::PolycentricClient>>,
@@ -44,9 +42,8 @@ fn merge_list_claims_responses(
4442
merged.encode_to_vec()
4543
}
4644

47-
/// List the verification claims created by `claimed_by_identity` across
48-
/// the configured servers. Emits serialized `ListClaimsResponse` proto
49-
/// bytes with `event_bundles` deduped by `EventKey` and validated.
45+
/// List an identity's verification claims across servers. Emits serialized
46+
/// `ListClaimsResponse` bytes.
5047
pub fn list_claims(
5148
query_client: &QueryClient<Vec<u8>>,
5249
query_key: Option<QueryKey>,

protos/polycentric/v2/content.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ message Content {
2222
// Verifications (see verifications.proto)
2323
VerificationClaim verification_claim = 12;
2424
VerificationVerify verification_verify = 13;
25+
VerificationTarget verification_target = 14;
2526
}
2627
}
2728

protos/polycentric/v2/verifications.proto

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,15 @@ message VerificationClaim {
5454
SerializedVerificationSchema schema = 1;
5555
// Values keyed by FieldDef.key, decoded per the schema's FieldKind.
5656
map<string, bytes> fields = 2;
57-
// Identities this claim is intended for
58-
repeated string target_identities = 3;
57+
}
58+
59+
// Targets a claim at one or more identities. Separate from the claim so
60+
// targeting can be set (or changed) after the claim is created.
61+
message VerificationTarget {
62+
// The claim event being targeted.
63+
EventKey claim_event_key = 1;
64+
// Identities the claim is intended for.
65+
repeated string target_identities = 2;
5966
}
6067

6168
// ── A verifier's attestation ──

protos/polycentric/v2/verifications_service.proto

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,17 @@ package polycentric.v2;
33

44
import "polycentric/v2/events.proto";
55

6-
// RPC surface for verification claims. Kept separate from
7-
// verifications.proto because the response references EventBundle
8-
// (events.proto), and events.proto -> content.proto -> verifications.proto
9-
// already form a chain; importing events.proto from verifications.proto
10-
// would create a cyclic import.
6+
// Separate from verifications.proto: that file is imported by content.proto,
7+
// so importing events.proto (for EventBundle) there would be a cyclic import.
118

129
message ListClaimsRequest {
13-
// Identity whose verification claims to list.
1410
string claimed_by_identity = 1;
1511
}
1612

1713
message ListClaimsResponse {
18-
// Claim events created by the identity, newest first.
1914
repeated EventBundle event_bundles = 1;
2015
}
2116

2217
service VerificationsService {
23-
// List the verification claims created by an identity.
2418
rpc ListClaims(ListClaimsRequest) returns (ListClaimsResponse);
2519
}

0 commit comments

Comments
 (0)