MCPcopy Create free account
hub / github.com/dfinity/orbit / getIdentityPemFilePath

Function getIdentityPemFilePath

cli/src/utils.ts:128–146  ·  view source on GitHub ↗
(identity: string)

Source from the content-addressed store, hash-verified

126};
127
128export const getIdentityPemFilePath = async (identity: string): Promise<string> => {
129 if (!existsSync(DFX_DEFAULT_IDENTITY_STORE_PATH)) {
130 throw new Error('Identity store not found.');
131 }
132
133 const possiblePaths = [
134 join(DFX_DEFAULT_IDENTITY_STORE_PATH, identity, `${identity}.pem`),
135 join(DFX_DEFAULT_IDENTITY_STORE_PATH, identity, `identity.pem`),
136 join(DFX_DEFAULT_IDENTITY_STORE_PATH, identity, `id.pem`),
137 ];
138
139 for (const path of possiblePaths) {
140 if (existsSync(path)) {
141 return path;
142 }
143 }
144
145 throw new Error(`PEM file not found for identity: ${identity}`);
146};

Callers 1

publish.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected