Skip to content

Commit

Permalink
adds IPEX admit
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Griffin <[email protected]>
  • Loading branch information
m00sey committed Oct 25, 2023
1 parent dcf6394 commit 9245162
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/keri/app/credentialing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,4 +759,35 @@ export class Ipex {
);
}

/**
* Create an IPEX admit EXN message
* @async
* @param {string} name Name or alias of the identifier
* @param {string} message accompany human readable description of the credential being admitted
* @param {string} grant qb64 SAID of grant message this admit is responding to
* @param {string} datetime Optional datetime to set for the credential
* @returns {Promise<[Serder, string[], string]>} A promise to the long-running operation
*/
async admit(
name: string,
message: string,
grant: string,
datetime?: string,
): Promise<[Serder, string[], string]> {
let hab = await this.client.identifiers().get(name);
let data: any = {
m: message,
}

return this.client.exchanges().createExchangeMessage(
hab,
'/ipex/admit',
data,
{},
undefined,
datetime,
grant
);
}

}
25 changes: 25 additions & 0 deletions test/app/credentialing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,5 +414,30 @@ describe("Ipex", () => {
)
assert.equal(end, "-LAD4AACA-e-acdc-LAD5AACAA-e-iss-LAE5AACAA-e-anc-vtest")


let [admit, asigs, aend] = await ipex.admit(
'holder',
'',
grant.ked.d,
mockCredential.sad.a.dt)

assert.deepStrictEqual(admit.ked, {
v: 'KERI10JSON000111_',
t: 'exn',
d: 'EB7FkJBteJSZVV_dsjd0dmx6ORoRO6hJY91HR0z-x9tF',
i: 'ELUvZ8aJEHAQE-0nsevyYTP98rBbGJUrTj5an-pCmwrK',
p: 'ECO262mMZcwP94aY0cUl5IL6LOK_R_Md1irVDdQEwtHl',
dt: '2023-08-23T15:16:07.553000+00:00',
r: '/ipex/admit',
q: {},
a: {'m': ''},
e: {},
})

assert.deepStrictEqual(asigs, [
'AAD6NAWzEr_KonMJhKL32JLTVZ2_xwVNMqlr-ovAwoIQS5IEWZ8POd4rbWO49-8NqK8GedjUyii3y9o1b0QkYzQJ'
])

assert.equal(aend, "")
})
})

0 comments on commit 9245162

Please sign in to comment.