a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(identity): `isKeyDid` for checking did:key identifiers

Mary 2fe56587 c1582e00

+16
+5
.changeset/cruel-bottles-visit.md
··· 1 + --- 2 + '@atcute/identity': patch 3 + --- 4 + 5 + introduce `isKeyDid` for checking did:key identifiers
+1
packages/identity/identity/lib/index.ts
··· 4 4 export * from './utils.js'; 5 5 6 6 export * from './did.js'; 7 + export * from './methods/key.js'; 7 8 export * from './methods/plc.js'; 8 9 export * from './methods/web.js';
+10
packages/identity/identity/lib/methods/key.ts
··· 1 + import type { Did } from '@atcute/lexicons'; 2 + 3 + const KEY_DID_RE = /^did:key:z[a-km-zA-HJ-NP-Z1-9]+$/; 4 + 5 + /** 6 + * checks if input is a did:key identifier 7 + */ 8 + export const isKeyDid = (input: string): input is Did<'key'> => { 9 + return input.length >= 10 && KEY_DID_RE.test(input); 10 + };