Skip to content

Commit

Permalink
feat: group ipex presentations (offer, grant) with leader (#866)
Browse files Browse the repository at this point in the history
* feat: multi-sig ipex presentations (offer, grant) with leader

* feat(core): interface to get cred said from current ms offer said
  • Loading branch information
iFergal authored Dec 12, 2024
1 parent 4a48787 commit e64a571
Show file tree
Hide file tree
Showing 22 changed files with 1,665 additions and 2,456 deletions.
13 changes: 7 additions & 6 deletions src/core/__fixtures__/agent/ipexCommunicationFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const offerForPresentingExnMessage = {
},
};

// @TODO - foconnor: Agree must have valid p, and no embeds - but causing tests to fail right now.
const agreeForPresentingExnMessage = {
exn: {
v: "KERI10JSON000516_",
Expand Down Expand Up @@ -543,7 +544,7 @@ const ipexOfferSig = [
"AAAfM-MSYZSCt1WdeLWLwYsuTYgpMTwpTwGXEtHIcizCAKoDw4b8Gc725TSHRaKELr7B9PojuGx9OXT-Fulx_oEF",
];

const ipexSubmitOfferSerder = {
const multisigOfferSerder = {
kind: "JSON",
raw: "{\"v\":\"KERI10JSON0004f5_\",\"t\":\"exn\",\"d\":\"EARi8kQ1PkSSRyFEIPOFPdnsnv7P2QZYEQqnmr1Eo2N8\",\"i\":\"EAsQ-kwJwO8ug-S2dk1WGwpPlF4hT3q5TJi_OLZSFdEy\",\"rp\":\"EOb2ITawuAc6mAeSn4SMuHZtB9mIHfZzac_1NO28eytd\",\"p\":\"\",\"dt\":\"2024-10-02T15:26:01.003000+00:00\",\"r\":\"/multisig/exn\",\"q\":{},\"a\":{\"i\":\"EOb2ITawuAc6mAeSn4SMuHZtB9mIHfZzac_1NO28eytd\",\"gid\":\"EBopw9UjL8plPiTfqJbb819-l2Jsr-0de7YXGxzKGRq4\"},\"e\":{\"exn\":{\"v\":\"KERI10JSON000340_\",\"t\":\"exn\",\"d\":\"EGfyfKc4tnZtigxgaw_55NEa13-5zpFXkheLv2jZiwI1\",\"i\":\"EBopw9UjL8plPiTfqJbb819-l2Jsr-0de7YXGxzKGRq4\",\"rp\":\"EOb2ITawuAc6mAeSn4SMuHZtB9mIHfZzac_1NO28eytd\",\"p\":\"ENdg2aG1gOXitYwI1xKZNch0VFAmZuFpvL0Xftliv0W9\",\"dt\":\"2024-10-02T15:23:50.210000+00:00\",\"r\":\"/ipex/offer\",\"q\":{},\"a\":{\"i\":\"EOb2ITawuAc6mAeSn4SMuHZtB9mIHfZzac_1NO28eytd\",\"m\":\"\"},\"e\":{\"acdc\":{\"v\":\"ACDC10JSON00018e_\",\"d\":\"ELKa5OdxusflKLZBqmHI09vYgyiySh4ZM1CQcoS6Nabh\",\"i\":\"EOb2ITawuAc6mAeSn4SMuHZtB9mIHfZzac_1NO28eytd\",\"ri\":\"EN1AomPsN0gmQS47DCaI3hz6rJovMz2aiLSfXDit_UrU\",\"s\":\"EJxnJdxkHbRw2wVFNe4IUOPLt8fEtg9Sr3WyTjlgKoIb\",\"a\":{\"d\":\"ENnh02JAwpkWVo8ExuuwgBGQB9fG8Zapg99H4dT6a_93\",\"i\":\"EBopw9UjL8plPiTfqJbb819-l2Jsr-0de7YXGxzKGRq4\",\"attendeeName\":\"99\",\"dt\":\"2024-10-02T15:21:50.607000+00:00\"}},\"d\":\"ECc3mOk1p4QceI4bGBoVhv7cVX34n-UOlK73VSm7m_fS\"}},\"d\":\"EKNY8J1PflxKy72qqE05SKmej4SpEecFAGFA3cLSPTKj\"}}",
ked: {
Expand Down Expand Up @@ -598,11 +599,11 @@ const ipexSubmitOfferSerder = {
size: 1269,
};

const ipexSubmitOfferSig = [
const multisigOfferSig = [
"AABBRge2Ep77V-0IJqMRXkIY1D8xdk_OtHd-EcFWMzHyjXVAkMvfQtA6DTn5NOACCxmERr9vvmm7V5KeXRSPIqMB",
];

const ipexSubmitOfferEnd =
const multisigOfferEnd =
"-LA35AACAA-e-exn-FABEBopw9UjL8plPiTfqJbb819-l2Jsr-0de7YXGxzKGRq40AAAAAAAAAAAAAAAAAAAAAAAEBopw9UjL8plPiTfqJbb819-l2Jsr-0de7YXGxzKGRq4-AABABCbsGn3CwRsUnzBhMitf8Mr6eHO5zv4-BNInB0rUTGhd86rIvz3kbzBqOBAAmbOOM4PwX08hzcgoomGk45cbxEO";

const ipexAdmitSerder = {
Expand Down Expand Up @@ -728,9 +729,9 @@ export {
credentialProps,
ipexOfferSerder,
ipexOfferSig,
ipexSubmitOfferSerder,
ipexSubmitOfferSig,
ipexSubmitOfferEnd,
multisigOfferSerder,
multisigOfferSig,
multisigOfferEnd,
multisigParticipantsProps,
ipexGrantSerder,
ipexGrantSig,
Expand Down
37 changes: 14 additions & 23 deletions src/core/__fixtures__/agent/keriaNotificationFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,32 +87,13 @@ const agreeForPresentingExnMessage = {
t: "exn",
d: "EJ1jbI8vTFCEloTfSsZkBpV0bUJnhGVyak5q-5IFIglL",
i: "EC9bQGHShmp2Juayqp0C5XcheBiHyc1p54pZ_Op-B95x",
p: "",
p: "EE-gjeEni5eCdpFlBtG7s4wkv7LJ0JmWplCS4DNQwW2G",
rp: "EBEWfIUOn789yJiNRnvKqpbWE3-m6fSDxtu6wggybbli",
dt: "2024-07-30T04:19:55.801000+00:00",
r: ExchangeRoute.IpexAgree,
q: {},
a: { m: "", i: "EE-gjeEni5eCdpFlBtG7s4wkv7LJ0JmWplCS4DNQwW2G" },
e: {
acdc: {
d: "EAe_JgQ636ic-k34aUQMjDFPp6Zd350gEsQA6HePBU5W",
i: "EC9bQGHShmp2Juayqp0C5XcheBiHyc1p54pZ_Op-B95x",
s: "EBIFDhtSE0cM4nbTnaMqiV1vUIlcnbsqBMeVMmeGmXOu",
a: {
d: "ELHCh_X2aw7C-aYesOM4La23a5lsoNuJDuCsJuxwO2nq",
i: "EE-gjeEni5eCdpFlBtG7s4wkv7LJ0JmWplCS4DNQwW2G",
dt: "2024-07-30T04:19:55.348000+00:00",
attendeeName: "ccc",
},
},
iss: {
t: "iss",
d: "EHStOgwJku_Ln-YN2ohgWUH-CI07SyJnFppSbF8kG4PO",
i: "EEqfWy-6jx_FG0RNuNxZBh_jq6Lq1OPuvX5m3v1Bzxdn",
s: "0",
dt: "2024-07-30T04:19:55.348000+00:00",
},
d: "EKBPPnWxYw2I5CtQSyhyn5VUdSTJ61qF_-h-NwmFRkIF",
},
a: { m: "" },
e: {},
},
pathed: {
acdc: "-IABEEqfWy-6jx_FG0RNuNxZBh_jq6Lq1OPuvX5m3v1Bzxdn0AAAAAAAAAAAAAAAAAAAAAAAEHStOgwJku_Ln-YN2ohgWUH-CI07SyJnFppSbF8kG4PO",
Expand Down Expand Up @@ -363,6 +344,15 @@ const notificationIpexOfferProp = {
},
};

const groupIdentifierMetadataRecord = {
type: "IdentifierMetadataRecord",
id: "EC1cyV3zLnGs4B9AYgoGNjXESyQZrBWygz3jLlRD30bR",
displayName: "holder",
multisigManageAid: "EAL7pX9Hklc_iq7pkVYSjAilCfQX3sr5RbX76AxYs2UH",
createdAt: new Date(),
updatedAt: new Date(),
};

export {
credentialMetadataMock,
grantForIssuanceExnMessage,
Expand All @@ -381,4 +371,5 @@ export {
notificationIpexApplyProp,
credentialStateIssued,
notificationIpexOfferProp,
groupIdentifierMetadataRecord,
};
1 change: 1 addition & 0 deletions src/core/agent/agent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type ExnMessage = {
acdc?: string;
iss?: string;
anc?: string;
exn?: string;
};
};

Expand Down
6 changes: 2 additions & 4 deletions src/core/agent/records/basicStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import {
Query,
SaveBasicRecordOption,
StorageApi,
StorageMessage,
StorageService,
} from "../../storage/storage.types";
import { BasicRecord } from "./basicRecord";

class BasicStorage implements StorageApi {
static readonly RECORD_DOES_NOT_EXIST_ERROR_MSG =
"Record does not exist with id";

private storageService: StorageService<BasicRecord>;

constructor(storageService: StorageService<BasicRecord>) {
Expand Down Expand Up @@ -49,7 +47,7 @@ class BasicStorage implements StorageApi {
if (
error instanceof Error &&
error.message ===
`${BasicStorage.RECORD_DOES_NOT_EXIST_ERROR_MSG} ${record.id}`
`${StorageMessage.RECORD_DOES_NOT_EXIST_ERROR_MSG} ${record.id}`
) {
await this.save(record);
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/core/agent/records/notificationRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface NotificationRecordStorageProps {
multisigId?: string;
connectionId: string;
credentialId?: string;
linkedGroupRequest?: LinkedGroupRequest;
}

class NotificationRecord extends BaseRecord {
Expand All @@ -38,7 +39,7 @@ class NotificationRecord extends BaseRecord {
this.multisigId = props.multisigId;
this.connectionId = props.connectionId;
this._tags = props.tags ?? {};
this.linkedGroupRequest = { accepted: false };
this.linkedGroupRequest = props.linkedGroupRequest ?? { accepted: false };
this.credentialId = props.credentialId;
}
}
Expand Down
Loading

0 comments on commit e64a571

Please sign in to comment.