Skip to content

Commit

Permalink
Update lit resource prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hwrdtm committed May 12, 2023
1 parent 1b6f26f commit 458ef0f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ describe('Session', () => {
litResource,
]);
expect(sessionCapabilityObject.attenuations).to.deep.equal({
[`lit-acc://${hashedResourceId}`]: {
[`lit-accesscontrolcondition://${hashedResourceId}`]: {
'*/*': [{}],
},
});
Expand Down
6 changes: 3 additions & 3 deletions packages/auth-helpers/src/lib/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export enum LitAbility {
* @description These resource prefixes are also used as valid IRI schemes.
*/
export enum LitResourcePrefix {
AccessControlCondition = 'lit-acc',
AccessControlCondition = 'lit-accesscontrolcondition',
PKP = 'lit-pkp',
RLI = 'lit-rli',
LitAction = 'lit-la',
RLI = 'lit-ratelimitincrease',
LitAction = 'lit-litaction',
}

export interface ISessionCapabilityObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('recapSessionCapabilityObject', () => {
);
const decodedRecapSessionCapabilityObject =
RecapSessionCapabilityObject.decode(
'urn:recap:eyJhdHQiOnsibGl0OmFjYzpzb21lUmVzb3VyY2UiOnsiQWNjZXNzQ29udHJvbENvbmRpdGlvbi9kZWNyeXB0aW9uIjpbe31dfX0sInByZiI6W119'
'urn:recap:eyJhdHQiOnsibGl0LWFjY2Vzc2NvbnRyb2xjb25kaXRpb246Ly9zb21lUmVzb3VyY2UiOnsiVGhyZXNob2xkL0RlY3J5cHRpb24iOlt7fV19fSwicHJmIjpbXX0='
);
expect(decodedRecapSessionCapabilityObject).toEqual(
recapSessionCapabilityObject
Expand Down Expand Up @@ -193,7 +193,7 @@ describe('recapSessionCapabilityObject', () => {
}' for '${litResource.getResourceKey()}'.`
);
expect(newSiweMessage.resources).toEqual([
'urn:recap:eyJhdHQiOnsibGl0LWFjYzovL3NvbWVSZXNvdXJjZSI6eyJUaHJlc2hvbGQvRGVjcnlwdGlvbiI6W3t9XX19LCJwcmYiOltdfQ',
'urn:recap:eyJhdHQiOnsibGl0LWFjY2Vzc2NvbnRyb2xjb25kaXRpb246Ly9zb21lUmVzb3VyY2UiOnsiVGhyZXNob2xkL0RlY3J5cHRpb24iOlt7fV19fSwicHJmIjpbXX0',
]);
});

Expand All @@ -207,7 +207,7 @@ describe('recapSessionCapabilityObject', () => {

const siweResource = recapSessionCapabilityObject.encodeAsSiweResource();
expect(siweResource).toEqual(
'urn:recap:eyJhdHQiOnsibGl0LWFjYzovL3NvbWVSZXNvdXJjZSI6eyJUaHJlc2hvbGQvRGVjcnlwdGlvbiI6W3t9XX19LCJwcmYiOltdfQ'
'urn:recap:eyJhdHQiOnsibGl0LWFjY2Vzc2NvbnRyb2xjb25kaXRpb246Ly9zb21lUmVzb3VyY2UiOnsiVGhyZXNob2xkL0RlY3J5cHRpb24iOlt7fV19fSwicHJmIjpbXX0'
);
});

Expand Down
6 changes: 3 additions & 3 deletions packages/auth-helpers/src/lib/resources.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import {

const testVectors = [
{
resourceKey: 'lit-acc://someResource',
resourceKey: 'lit-accesscontrolcondition://someResource',
expectedLitResource: new LitAccessControlConditionResource('someResource'),
},
{
resourceKey: 'lit-pkp://someResource',
expectedLitResource: new LitPKPResource('someResource'),
},
{
resourceKey: 'lit-rli://someResource',
resourceKey: 'lit-ratelimitincrease://someResource',
expectedLitResource: new LitRLIResource('someResource'),
},
{
resourceKey: 'lit-la://someResource',
resourceKey: 'lit-litaction://someResource',
expectedLitResource: new LitActionResource('someResource'),
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe('LitNodeClientNodeJs', () => {
let sessionCapabilityObject =
litNodeClient.generateSessionCapabilityObjectWithWildcards([litResource]);
expect(sessionCapabilityObject.attenuations).toStrictEqual({
[`lit-acc://${hashedResourceId}`]: {
[`lit-accesscontrolcondition://${hashedResourceId}`]: {
'*/*': [{}],
},
});
Expand Down

0 comments on commit 458ef0f

Please sign in to comment.