UNPKG

@titanium-sdk/ti.identity

Version:

A collection of API's to authenticate with your device: Keychain/Keystore, Touch ID and Face ID (iOS only)

30 lines (24 loc) 819 B
'use strict'; exports.id = 'ti.identity'; exports.cliVersion = '>=3.2'; exports.init = function init(logger, config, cli, _appc) { cli.on('build.ios.writeEntitlements', { pre: function (data, finished) { // The team-id-prefix will be generated by the CLI on device builds, // getting the team-id from the provisioning profile. if (cli.argv.target !== 'simulator') { finished(); return; } var applicationIdentifier = '$(AppIdentifierPrefix)' + this.tiapp.id; var plist = data.args[0]; Array.isArray(plist['keychain-access-groups']) || (plist['keychain-access-groups'] = []); if (!plist['keychain-access-groups'].some(function (id) { return id === applicationIdentifier; })) { plist['keychain-access-groups'].push(applicationIdentifier); } finished(); } }); };