-
Notifications
You must be signed in to change notification settings - Fork 18
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
feature/SDK-56_oauth-status-list #302
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See remarks. Migration comment is the biggest issue
await queryRunner.query( | ||
`CREATE TABLE "StatusListEntry" ("statusListId" character varying NOT NULL, "statusListIndex" integer NOT NULL, "credentialId" character varying, "credentialHash" character varying(128), "correlationId" character varying(255), "value" character varying(50), CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex"))`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide an actual migration instead of updating the existing migration file. We have a customer in production that is using StatusLists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
export type StatusListCredential = W3CVerifiableCredential | CWT | ||
|
||
export type ProofFormat = VmoProofFormat | 'cbor' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please just use the word Veramo in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
throw new Error(`Invalid status list type ${typeof entity}`) | ||
} | ||
|
||
function setBaseFields(entity: StatusListEntity, args: IStatusListEntity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixing of arrow functions with regular functions in the same file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
entity.statusListCredential = args.statusListCredential | ||
} | ||
|
||
function getBaseFields(entity: StatusListEntity): Omit<IStatusListEntity, 'type'> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixing of arrow functions with regular functions in the same file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
this._statusListLength = details.length | ||
|
||
// (StatusListStore does the duplicate entity check) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes with a less descriptive error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh?
in develop we have
if (entity) {
throw Error(`Status list ${details.id}, correlationId ${args.correlationId} already exists`)
}
In StatusListStore we have
if (result) {
throw Error(`Status list for id ${id}, correlationId ${correlationId} already exists`)
}
export const DEFAULT_LIST_LENGTH = 250000 | ||
export const DEFAULT_PROOF_FORMAT = 'jwt' as ProofFormat | ||
export const STATUS_LIST_JWT_HEADER: StatusListJWTHeaderParameters = { | ||
alg: 'EdDSA', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this fixed? If this is a default object, make it clear in the name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
That came from the sd-jwt library test, should not have been there anymore.
Alg is comming from
getSigningAlgo(resolution.key.type)
|
||
type IRequiredContext = IAgentContext<ICredentialPlugin & IJwtService & IIdentifierResolution> | ||
|
||
export const BITS_PER_STATUS_DEFAULT = 2 // 2 bits are sufficient for 0x00 - "VALID" 0x01 - "INVALID" & 0x02 - "SUSPENDED" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with the inconsistencies of the word DEFAULT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed (happened when using ctrl-alt-c in different sessions)
return StatusListFactory.instance | ||
} | ||
|
||
public getImplementation(type: StatusListType): IStatusList { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getByType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
statusListMap: com.sphereon.cbor.CborMap<com.sphereon.cbor.CborString, com.sphereon.cbor.CborItem<any>>, | ||
) { | ||
const exp = Math.floor(new Date().getTime() / 1000) | ||
const ttl = 65535 // FIXME figure out what value should be / come from and what the difference is with exp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please figure out what the difference is. Otherwise create a ticket and link it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ttl: OPTIONAL. The ttl (time to live) claim, if present, MUST
specify the maximum amount of time, in seconds, that the Status
List Token can be cached by a consumer before a fresh copy SHOULD
be retrieved. The value of the claim MUST be a positive number
encoded in JSON as a number.
Do we want to use / implement this now?
packages/vc-status-list/src/utils.ts
Outdated
} else if (CredentialMapper.isMsoMdocOid4VPEncoded(credential)) { | ||
// Just assume Cbor for now, I'd need to decode at least the header to what type of Cbor we have | ||
return 'cbor' | ||
} else if (CredentialMapper.isCredential(credential)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dangerous. It now assumes everything else is json-ld
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored using detectDocumentType
… expiresAt handling
…th-status-list # Conflicts: # packages/ssi-types/src/types/index.ts
expect(fromDb).toBeDefined() | ||
expect(fromDb.issuer).toEqual(statusList.issuer) | ||
expect(typeof fromDb.issuer).toEqual('object') | ||
expect((fromDb.issuer as any).id).toEqual('did:example:123') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"any" alternative here?
@@ -158,11 +144,37 @@ export class StatusListStore implements IStatusListStore { | |||
return !error | |||
} | |||
|
|||
async removeStatusListEntryByIndex(args: IGetStatusListEntryByIndexArgs): Promise<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async removeStatusListEntryByIndex(args: IGetStatusListEntryByIndexArgs): Promise<boolean> { | |
async removeStatusListEntryByIndex(args: IGetStatusListEntryByIndexArgs, error: boolean = false): Promise<boolean> { |
than don't need to add a let on the body
Unfortunately this is became a big PR.
The data store also needed work to accommodate multiple status list types and tests were missing for it altogether in the data-store.